Flutter-Ernaehrungsapp/lib/android/pages/nav_pages/progress_page.dart

71 lines
2.6 KiB
Dart
Raw Normal View History

2023-06-16 08:34:41 +02:00
import 'package:ernaehrung/android/components/chart/chart.dart';
2023-05-29 12:08:46 +02:00
import 'package:ernaehrung/android/components/meal_page_text/secondary_big_text_component.dart';
import 'package:ernaehrung/android/components/meal_page_text/secondary_text_component.dart';
import 'package:ernaehrung/android/components/meal_page_text/title_component.dart';
import 'package:ernaehrung/android/config/statistics.dart';
2023-05-29 12:08:46 +02:00
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import '../../config/format_helper.dart';
2023-05-29 12:08:46 +02:00
class ProgressPage extends StatelessWidget {
final String title;
final Color backgroundColor = const Color(0xff47a44b);
const ProgressPage({Key? key, required this.title}) : super(key: key);
String get getTitle => title;
@override
String toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) {
return getTitle;
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
2023-06-02 01:42:56 +02:00
child: Column(
children: [
2023-06-16 08:34:41 +02:00
const ChartComponent(),
2023-06-02 01:42:56 +02:00
Container(
margin: const EdgeInsets.fromLTRB(0, 16, 0, 0),
decoration: const BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8))),
child: Padding(
padding:
const EdgeInsets.symmetric(vertical: 8, horizontal: 16),
child: ValueListenableBuilder(
valueListenable:
StatisticsService.instance.weeklyCaloryRanking,
builder: (context, value, child) {
return Column(
children: [
const TitleComponent(
"Lebensmittel mit dem höchsten Kaloriengehalt"),
const SizedBox(
height: 24,
),
for (var item in value.toSet())
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
SecondaryTextComponent(
getWeeklyRankingString(item.name)),
SecondaryTextComponent(
item.calories.toString()),
],
),
],
);
},
),
))
],
2023-05-29 12:08:46 +02:00
),
),
);
}
}