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/material.dart';
|
|
|
|
|
|
|
|
class StatisticsPercentage extends StatelessWidget {
|
|
|
|
final double heightStatisticsContainer = 220.0;
|
|
|
|
final double widthStatisticsContainer = double.infinity;
|
|
|
|
|
|
|
|
const StatisticsPercentage({Key? key}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
2023-06-01 11:46:53 +02:00
|
|
|
Widget build(BuildContext context) {
|
2023-06-02 00:38:19 +02:00
|
|
|
return ValueListenableBuilder<List<double>>(
|
|
|
|
valueListenable: StatisticsService.instance.ingredients,
|
|
|
|
builder: (context, value, child) {
|
|
|
|
return Container(
|
|
|
|
height: heightStatisticsContainer,
|
|
|
|
padding: const EdgeInsets.symmetric(vertical: 16, horizontal: 0),
|
|
|
|
child: Row(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
|
|
children: [
|
|
|
|
Expanded(
|
|
|
|
child: SizedBox(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.symmetric(
|
|
|
|
vertical: 0, horizontal: 8),
|
|
|
|
child: FittedBox(
|
|
|
|
child: CircularLoadingComponent(value[6].toInt()),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-05-29 12:08:46 +02:00
|
|
|
),
|
2023-06-02 00:38:19 +02:00
|
|
|
Expanded(
|
|
|
|
child: Column(
|
2023-05-30 21:03:46 +02:00
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
|
|
children: [
|
|
|
|
// TODO adjust 200 to values from user box
|
2023-06-02 00:38:19 +02:00
|
|
|
LineCircularWiTextComponent(Colors.lightGreen, value[0],
|
|
|
|
value[3].toInt(), "Fat (g)"),
|
|
|
|
LineCircularWiTextComponent(Colors.lightGreen, value[1],
|
|
|
|
value[4].toInt(), "Protein (g)"),
|
|
|
|
LineCircularWiTextComponent(Colors.lightGreen, value[2],
|
|
|
|
value[5].toInt(), "Carbohydrate (g)"),
|
2023-05-30 21:03:46 +02:00
|
|
|
],
|
2023-06-02 00:38:19 +02:00
|
|
|
))
|
|
|
|
],
|
2023-05-29 12:08:46 +02:00
|
|
|
),
|
2023-06-02 00:38:19 +02:00
|
|
|
);
|
|
|
|
});
|
2023-05-29 12:08:46 +02:00
|
|
|
}
|
|
|
|
}
|