Flutter-Ernaehrungsapp/lib/android/components/meal_page_text/statistics_today_component....

54 lines
2.1 KiB
Dart
Raw Normal View History

2023-05-29 12:08:46 +02:00
import 'package:ernaehrung/android/components/circular/circular_component.dart';
import 'package:ernaehrung/android/components/circular/line_circular_with_text_component.dart';
2023-05-30 16:17:51 +02:00
import 'package:ernaehrung/android/config/statistics.dart';
2023-05-29 12:08:46 +02:00
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
class StatisticsPercentage extends StatelessWidget {
final double heightStatisticsContainer = 220.0;
final double widthStatisticsContainer = double.infinity;
const StatisticsPercentage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
2023-05-30 16:17:51 +02:00
StatisticsService statisticsService = StatisticsService();
List<double> ingredients = statisticsService.getAllEatenIngredientsForTodayStatistics();
2023-05-29 12:08:46 +02:00
return Container(
decoration:
BoxDecoration(border: Border.all(width: 2.0, color: Colors.black)),
height: heightStatisticsContainer,
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 0),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
2023-05-30 16:17:51 +02:00
Expanded(
2023-05-29 12:08:46 +02:00
child: SizedBox(
child: Padding(
2023-05-30 16:17:51 +02:00
padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8),
2023-05-29 12:08:46 +02:00
child: FittedBox(
2023-05-30 16:17:51 +02:00
child: CircularLoadingComponent(statisticsService.getAllEatenCaloriesForTodayStatistics()),
2023-05-29 12:08:46 +02:00
),
),
),
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
// TODO adjust total values (200) to user inputs
2023-05-29 12:08:46 +02:00
LineCircularWiTextComponent(
Colors.green.shade400, ingredients[0], 200, "Fat (g)"),
2023-05-29 12:08:46 +02:00
LineCircularWiTextComponent(
Colors.green.shade400, ingredients[1], 200, "Protein (g)"),
2023-05-29 12:08:46 +02:00
LineCircularWiTextComponent(
Colors.green.shade400, ingredients[2], 200, "Carbohydrate (g)"),
2023-05-29 12:08:46 +02:00
],
),
)
],
),
);
}
}