import 'package:ernaehrung/android/components/chart/chart.dart'; 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'; import 'package:fl_chart/fl_chart.dart'; import 'package:flutter/material.dart'; import '../../config/format_helper.dart'; 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( child: Column( children: [ const ChartComponent(), 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()), ], ), ], ); }, ), )) ], ), ), ); } }