bugfix: fix type error

welcome
Bogdan Kotikov 2023-05-29 22:04:44 +02:00 committed by 98spag
parent d05683e0a6
commit a5d132aee6
6 changed files with 36 additions and 36 deletions

View File

@ -584,7 +584,7 @@
"languageVersion": "2.19" "languageVersion": "2.19"
} }
], ],
"generated": "2023-05-30T12:41:32.353955Z", "generated": "2023-05-30T14:26:53.205127Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "3.0.2" "generatorVersion": "3.0.2"
} }

View File

@ -1 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.0.27\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.1.10\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.1.6\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-05-30 15:30:51.485545","version":"3.10.2"} {"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"android":[{"name":"path_provider_android","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_android-2.0.27\\\\","native_build":true,"dependencies":[]}],"macos":[{"name":"path_provider_foundation","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_foundation-2.2.2\\\\","shared_darwin_source":true,"native_build":true,"dependencies":[]}],"linux":[{"name":"path_provider_linux","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_linux-2.1.10\\\\","native_build":false,"dependencies":[]}],"windows":[{"name":"path_provider_windows","path":"C:\\\\Users\\\\FUCHSLAU\\\\AppData\\\\Local\\\\Pub\\\\Cache\\\\hosted\\\\pub.dev\\\\path_provider_windows-2.1.6\\\\","native_build":false,"dependencies":[]}],"web":[]},"dependencyGraph":[{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]}],"date_created":"2023-05-30 16:26:57.078325","version":"3.10.2"}

View File

@ -38,11 +38,11 @@ class _CardComponentState extends State<CardComponent> {
} }
getImageOfMeal() { getImageOfMeal() {
if (widget.eatingMealName == dotenv.env['BREAKFAST_FIELD']!) { if (widget.eatingMealName.toLowerCase() == dotenv.env['BREAKFAST_FIELD']!.toLowerCase()) {
return const Image(image: AssetImage('assets/images/tea.png')); return const Image(image: AssetImage('assets/images/tea.png'));
} else if (widget.eatingMealName == dotenv.env['LUNCH_FIELD']!) { } else if (widget.eatingMealName.toLowerCase() == dotenv.env['LUNCH_FIELD']!.toLowerCase()) {
return const Image(image: AssetImage('assets/images/fries.png')); return const Image(image: AssetImage('assets/images/fries.png'));
} else if (widget.eatingMealName == dotenv.env['DINNER_FIELD']!) { } else if (widget.eatingMealName.toLowerCase() == dotenv.env['DINNER_FIELD']!.toLowerCase()) {
return const Image(image: AssetImage('assets/images/ice.png')); return const Image(image: AssetImage('assets/images/ice.png'));
} }
} }

View File

@ -1,7 +1,10 @@
import '../models/food.dart'; import '../models/food.dart';
List<Food> castDynamicToListFood(List<dynamic> dynamicList) { List<Food> castDynamicToListFood(dynamic dynamicList) {
List<Food> foodList = []; List<Food> foodList = [];
if(dynamicList == null){
return foodList;
}
for (Food element in dynamicList) { for (Food element in dynamicList) {
foodList.add(element); foodList.add(element);
} }

View File

@ -168,8 +168,8 @@ class StatisticsService {
int getAllEatenCaloriesForTodayStatistics(){ int getAllEatenCaloriesForTodayStatistics(){
Box box = Hive.box(reducedStatisticsBoxName); Box box = Hive.box(reducedStatisticsBoxName);
num sum = 0; num sum = 0;
for(List<Food> foods in box.values){ for(int i = 0; i < box.keys.length;i++){
for(Food food in foods){ for(Food food in box.get(box.keys.elementAt(i))){
sum += food.calories; sum += food.calories;
} }
} }

View File

@ -1,43 +1,40 @@
import 'package:basic_utils/basic_utils.dart';
import 'package:ernaehrung/android/components/card/card_component.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hive/hive.dart'; import 'package:hive_flutter/adapters.dart';
import '../../components/diet_chart_component.dart';
import '../../components/food_list_component.dart';
import '../../components/statistics_circular_indicator_component.dart';
class TodayPage extends StatefulWidget { class TodayPage extends StatefulWidget {
final String title; final String title;
final Color backgroundColor = const Color(0xff47a44b); final Color backgroundColor = const Color(0xff47a44b);
const TodayPage({Key? key, required this.title}) : super(key: key); const TodayPage({Key? key, required this.title}) : super(key: key);
@override @override
State<TodayPage> createState() => _TodayPageState(); State<TodayPage> createState() => _TodayPageState();
} }
class _TodayPageState extends State<TodayPage> { class _TodayPageState extends State<TodayPage> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: SizedBox( body: SingleChildScrollView(
width: double.infinity, child: ValueListenableBuilder(
height: double.infinity, valueListenable: Hive.box("TODAY").listenable(),
child: Container( builder: (context, box, widget) {
decoration: const BoxDecoration( return ListView.builder(
gradient: LinearGradient( primary: false,
colors: [Color(0xff000000), Color(0xff47a44b)], shrinkWrap: true,
stops: [0.1, 5], itemCount: box.keys.length,
begin: Alignment.bottomCenter, itemBuilder: (context, i) {
end: Alignment.topCenter, if (box.keyAt(i).toString() == "DATE") {
)), return const SizedBox.shrink();
child: SingleChildScrollView( } else {
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 0), return CardComponent(
child: Column( StringUtils.capitalize(box.keyAt(i).toString()),
children: [ box.getAt(i)
StatisticsPercentComponent(300, 100, 400), );
DietChatComponent(1500), }
FoodComponent(box: Hive.box('TODAY'),), });
], })));
),
)),
));
} }
} }