diff --git a/lib/android/config/statistics.dart b/lib/android/config/statistics.dart index 09c289b..67df099 100644 --- a/lib/android/config/statistics.dart +++ b/lib/android/config/statistics.dart @@ -214,6 +214,11 @@ class StatisticsService { return sum as int; } + double getCaloryTargetForOneDay(){ + final Box userBox = Hive.box("USER_BOX"); + return userBox.get("USER").kalorien.toDouble(); + } + List getAllEatenIngredientsForTodayStatistics(double dayLen){ Box box = Hive.box(todayStatisticsBoxName); final Box userBox = Hive.box("USER_BOX"); diff --git a/lib/android/pages/nav_pages/progress_page.dart b/lib/android/pages/nav_pages/progress_page.dart index d2c200b..a19aafb 100644 --- a/lib/android/pages/nav_pages/progress_page.dart +++ b/lib/android/pages/nav_pages/progress_page.dart @@ -169,6 +169,20 @@ class ProgressPage extends StatelessWidget { barGroups: value, gridData: FlGridData(show: false), alignment: BarChartAlignment.spaceAround, + extraLinesData: ExtraLinesData( + horizontalLines: [ + HorizontalLine( + y: StatisticsService.instance.getCaloryTargetForOneDay(), // Specify the y-value where you want the line to be positioned + color: Colors.black, // Change the color as per your requirement + strokeWidth: 2, // Adjust the width as needed + dashArray: [3, 2], + label: HorizontalLineLabel( + show: true, + labelResolver: (x) => "Zielwert" + ) + ), + ], + ), ), ), ),