bugfix: fix type error
parent
d05683e0a6
commit
a5d132aee6
|
@ -584,7 +584,7 @@
|
|||
"languageVersion": "2.19"
|
||||
}
|
||||
],
|
||||
"generated": "2023-05-30T12:41:32.353955Z",
|
||||
"generated": "2023-05-30T14:26:53.205127Z",
|
||||
"generator": "pub",
|
||||
"generatorVersion": "3.0.2"
|
||||
}
|
||||
|
|
|
@ -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"}
|
|
@ -38,11 +38,11 @@ class _CardComponentState extends State<CardComponent> {
|
|||
}
|
||||
|
||||
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'));
|
||||
} 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'));
|
||||
} 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'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,10 @@
|
|||
import '../models/food.dart';
|
||||
|
||||
List<Food> castDynamicToListFood(List<dynamic> dynamicList) {
|
||||
List<Food> castDynamicToListFood(dynamic dynamicList) {
|
||||
List<Food> foodList = [];
|
||||
if(dynamicList == null){
|
||||
return foodList;
|
||||
}
|
||||
for (Food element in dynamicList) {
|
||||
foodList.add(element);
|
||||
}
|
||||
|
@ -17,4 +20,4 @@ Map<String,List<Food>> castDynamicMap(dynamic dynamicMap){
|
|||
foodMap.putIfAbsent(key as String , () => castDynamicToListFood(dynamicMap[key]));
|
||||
}
|
||||
return foodMap;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,8 +168,8 @@ class StatisticsService {
|
|||
int getAllEatenCaloriesForTodayStatistics(){
|
||||
Box box = Hive.box(reducedStatisticsBoxName);
|
||||
num sum = 0;
|
||||
for(List<Food> foods in box.values){
|
||||
for(Food food in foods){
|
||||
for(int i = 0; i < box.keys.length;i++){
|
||||
for(Food food in box.get(box.keys.elementAt(i))){
|
||||
sum += food.calories;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:hive/hive.dart';
|
||||
import '../../components/diet_chart_component.dart';
|
||||
import '../../components/food_list_component.dart';
|
||||
import '../../components/statistics_circular_indicator_component.dart';
|
||||
import 'package:hive_flutter/adapters.dart';
|
||||
|
||||
class TodayPage extends StatefulWidget {
|
||||
final String title;
|
||||
final Color backgroundColor = const Color(0xff47a44b);
|
||||
|
||||
const TodayPage({Key? key, required this.title}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<TodayPage> createState() => _TodayPageState();
|
||||
}
|
||||
|
||||
class _TodayPageState extends State<TodayPage> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: SizedBox(
|
||||
width: double.infinity,
|
||||
height: double.infinity,
|
||||
child: Container(
|
||||
decoration: const BoxDecoration(
|
||||
gradient: LinearGradient(
|
||||
colors: [Color(0xff000000), Color(0xff47a44b)],
|
||||
stops: [0.1, 5],
|
||||
begin: Alignment.bottomCenter,
|
||||
end: Alignment.topCenter,
|
||||
)),
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 5, vertical: 0),
|
||||
child: Column(
|
||||
children: [
|
||||
StatisticsPercentComponent(300, 100, 400),
|
||||
DietChatComponent(1500),
|
||||
FoodComponent(box: Hive.box('TODAY'),),
|
||||
],
|
||||
),
|
||||
)),
|
||||
));
|
||||
body: SingleChildScrollView(
|
||||
child: ValueListenableBuilder(
|
||||
valueListenable: Hive.box("TODAY").listenable(),
|
||||
builder: (context, box, widget) {
|
||||
return ListView.builder(
|
||||
primary: false,
|
||||
shrinkWrap: true,
|
||||
itemCount: box.keys.length,
|
||||
itemBuilder: (context, i) {
|
||||
if (box.keyAt(i).toString() == "DATE") {
|
||||
return const SizedBox.shrink();
|
||||
} else {
|
||||
return CardComponent(
|
||||
StringUtils.capitalize(box.keyAt(i).toString()),
|
||||
box.getAt(i)
|
||||
);
|
||||
}
|
||||
});
|
||||
})));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue