diff --git a/lib/android/components/card/card_data_food_component.dart b/lib/android/components/card/card_data_food_component.dart index efa3e47..b757c87 100644 --- a/lib/android/components/card/card_data_food_component.dart +++ b/lib/android/components/card/card_data_food_component.dart @@ -9,11 +9,8 @@ class CardDataFoodComponent extends StatelessWidget { @override Widget build(BuildContext context) { - return Container( + return SizedBox( height: 180, - decoration: const BoxDecoration( - color: Colors.pink, - borderRadius: BorderRadius.all(Radius.circular(16))), child: Padding( padding: const EdgeInsets.symmetric(vertical: 8, horizontal: 8), child: SingleChildScrollView( @@ -25,7 +22,15 @@ class CardDataFoodComponent extends StatelessWidget { shrinkWrap: true, itemCount: foods.length, itemBuilder: (context, i) { - return CardFoodItemComponent(foods[i]); + return Column( + children: [ + CardFoodItemComponent(foods[i]), + Divider( + color: Colors.grey.shade300, + thickness: 1.2, + ) + ], + ); }) ], ), diff --git a/lib/android/components/circular/circular_component.dart b/lib/android/components/circular/circular_component.dart index 568a333..a0fe388 100644 --- a/lib/android/components/circular/circular_component.dart +++ b/lib/android/components/circular/circular_component.dart @@ -1,10 +1,12 @@ import 'package:ernaehrung/android/config/statistics.dart'; +import 'package:ernaehrung/android/models/user.dart'; import 'package:flutter/material.dart'; +import 'package:hive/hive.dart'; import 'package:percent_indicator/circular_percent_indicator.dart'; class CircularLoadingComponent extends StatelessWidget { - const CircularLoadingComponent({Key? key}) : super(key: key); - final int targetCaolries = 3500; // TODO get from user data + CircularLoadingComponent({Key? key}) : super(key: key); + final int? targetCaolries = Hive.box("USER_BOX").get("USER")?.kalorien; @override Widget build(BuildContext context) {; @@ -12,7 +14,7 @@ class CircularLoadingComponent extends StatelessWidget { return ValueListenableBuilder( valueListenable: StatisticsService.instance.eatenCalories, builder: (context, value, child) { - double progress = double.parse((value / targetCaolries).toStringAsFixed(1)); + double progress = double.parse((value / targetCaolries!).toStringAsFixed(1)); progress = progress > 1.0 ? 1.0 : progress; return Column( @@ -24,7 +26,7 @@ class CircularLoadingComponent extends StatelessWidget { lineWidth: 5.0, percent: progress, center: Text( - "$value/$targetCaolries kcal", + "$value/$targetCaolries Kcal", textAlign: TextAlign.center, ), progressColor: Colors.lightGreen, diff --git a/lib/android/components/meal_page_text/statistics_today_component.dart b/lib/android/components/meal_page_text/statistics_today_component.dart index 1808eaf..9fed7c2 100644 --- a/lib/android/components/meal_page_text/statistics_today_component.dart +++ b/lib/android/components/meal_page_text/statistics_today_component.dart @@ -1,7 +1,6 @@ import 'package:ernaehrung/android/components/circular/circular_component.dart'; import 'package:ernaehrung/android/components/circular/line_circular_with_text_component.dart'; import 'package:ernaehrung/android/config/statistics.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; class StatisticsPercentage extends StatelessWidget { @@ -11,7 +10,7 @@ class StatisticsPercentage extends StatelessWidget { const StatisticsPercentage({Key? key}) : super(key: key); @override - Widget build(BuildContext context) {; + Widget build(BuildContext context) { return Container( decoration: BoxDecoration(border: Border.all(width: 2.0, color: Colors.black)), @@ -20,10 +19,10 @@ class StatisticsPercentage extends StatelessWidget { child: Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - const Expanded( + Expanded( child: SizedBox( child: Padding( - padding: EdgeInsets.symmetric(vertical: 0, horizontal: 8), + padding: const EdgeInsets.symmetric(vertical: 0, horizontal: 8), child: FittedBox( child: CircularLoadingComponent(), ), @@ -34,6 +33,7 @@ class StatisticsPercentage extends StatelessWidget { child: ValueListenableBuilder>( valueListenable: StatisticsService.instance.ingredients, builder: (context, value, child) { + print("value ${value}"); return Column( mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ diff --git a/lib/android/components/statistics_circular_indicator_component.dart b/lib/android/components/statistics_circular_indicator_component.dart index 1051537..fcd648a 100644 --- a/lib/android/components/statistics_circular_indicator_component.dart +++ b/lib/android/components/statistics_circular_indicator_component.dart @@ -18,7 +18,7 @@ class StatisticsPercentComponent extends StatelessWidget { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Text("$eaten gegessen"), - const CircularLoadingComponent(), + CircularLoadingComponent(), Text("$calorienBurned verbrannt"), ], ); diff --git a/lib/android/config/statistics.dart b/lib/android/config/statistics.dart index 7b46f72..4cfc158 100644 --- a/lib/android/config/statistics.dart +++ b/lib/android/config/statistics.dart @@ -2,7 +2,6 @@ import 'dart:math'; import 'package:ernaehrung/android/components/meal_page_text/days_component.dart'; import 'package:ernaehrung/android/config/cast_helper.dart'; import 'package:fl_chart/fl_chart.dart'; -import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:hive/hive.dart'; import '../models/food.dart'; @@ -215,7 +214,7 @@ class StatisticsService { carbs += food.carbohydrateg; } } - return [fat as double,protein as double,carbs as double]; + return [fat.roundToDouble(),protein.roundToDouble(),carbs.roundToDouble()]; } void updateCalculationsAndNotfiyListenersForTodayStatistics(){