Merge remote-tracking branch 'origin/feature/show-only-today-meals-on-today-page' into feature/show-only-today-meals-on-today-page
commit
947ab18251
|
@ -0,0 +1,63 @@
|
||||||
|
|
||||||
|
import 'package:ernaehrung/android/components/meal_page_text/days_component.dart';
|
||||||
|
import 'package:ernaehrung/android/config/statistics.dart';
|
||||||
|
import 'package:hive/hive.dart';
|
||||||
|
import '../models/food.dart';
|
||||||
|
|
||||||
|
// TODO REMOVE IN PROD
|
||||||
|
|
||||||
|
mockDataForWholeWeek(){
|
||||||
|
StatisticsService statisticsService = StatisticsService.instance;
|
||||||
|
Box box = Hive.box('STATISTICS_MAIN');
|
||||||
|
int timestamp = statisticsService.getTimestampFromNow();
|
||||||
|
List<int> currentWeek = statisticsService.getTimestampsByTimestampAndTimespan(TimeSpan.week, timestamp);
|
||||||
|
for(int i = 0;i < currentWeek.length;i++){
|
||||||
|
print(mockFood(i));
|
||||||
|
box.put(currentWeek[i], mockFood(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mockFood(int i) {
|
||||||
|
List<Map<String,List<dynamic>>> foods = [
|
||||||
|
{
|
||||||
|
'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'FRÜHSTÜCK':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'MITTAGESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
'ABENDESSEN':[ Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),Food(167543,"Snacks Granola Bars Hard Almond","Snacks",495,25.5,7.7,62,0,4.8,),],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
return foods[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import 'package:ernaehrung/android/models/food.dart';
|
gitimport 'package:ernaehrung/android/models/food.dart';
|
||||||
import 'package:ernaehrung/android/models/user.dart';
|
import 'package:ernaehrung/android/models/user.dart';
|
||||||
import 'package:ernaehrung/web/web_app.dart';
|
import 'package:ernaehrung/web/web_app.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
@ -12,16 +12,12 @@ import 'android/config/setup_todaybox_config.dart';
|
||||||
void main() async {
|
void main() async {
|
||||||
await dotenv.load(fileName: ".env");
|
await dotenv.load(fileName: ".env");
|
||||||
await Hive.initFlutter();
|
await Hive.initFlutter();
|
||||||
|
|
||||||
if (!Hive.isAdapterRegistered(0)) {
|
if (!Hive.isAdapterRegistered(0)) {
|
||||||
Hive.registerAdapter(FoodAdapter());
|
Hive.registerAdapter(FoodAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Hive.isAdapterRegistered(1)) {
|
if (!Hive.isAdapterRegistered(1)) {
|
||||||
Hive.registerAdapter(UserAdapter());
|
Hive.registerAdapter(UserAdapter());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
await Hive.openBox(dotenv.env['STATISTICS_TODAY_BOX'] ?? 'STATISTICS_TODAY_BOX');
|
await Hive.openBox(dotenv.env['STATISTICS_TODAY_BOX'] ?? 'STATISTICS_TODAY_BOX');
|
||||||
await Hive.openBox( dotenv.env['STATISTICS_PROGRESS_BOX'] ?? 'STATISTICS_PROGRESS_BOX');
|
await Hive.openBox( dotenv.env['STATISTICS_PROGRESS_BOX'] ?? 'STATISTICS_PROGRESS_BOX');
|
||||||
await Hive.openBox(dotenv.env['STATISTICS_MAIN_BOX'] ?? 'STATISTICS_MAIN_BOX');
|
await Hive.openBox(dotenv.env['STATISTICS_MAIN_BOX'] ?? 'STATISTICS_MAIN_BOX');
|
||||||
|
@ -29,6 +25,7 @@ void main() async {
|
||||||
await Hive.openBox<User>('USER_BOX');
|
await Hive.openBox<User>('USER_BOX');
|
||||||
//Hive.deleteFromDisk();
|
//Hive.deleteFromDisk();
|
||||||
setupTodayBox();
|
setupTodayBox();
|
||||||
|
//mockDataForWholeWeek();
|
||||||
|
|
||||||
if (defaultTargetPlatform == TargetPlatform.android) {
|
if (defaultTargetPlatform == TargetPlatform.android) {
|
||||||
runApp(const AndroidApp());
|
runApp(const AndroidApp());
|
||||||
|
|
Loading…
Reference in New Issue