2023-05-10 00:04:33 +02:00
|
|
|
import 'package:ernaehrung/models/food.dart';
|
2023-04-23 13:08:04 +02:00
|
|
|
import 'package:ernaehrung/pages/nav_pages/main_page.dart';
|
2023-04-29 15:56:04 +02:00
|
|
|
import 'package:ernaehrung/views/navigation/navigation_screen.dart';
|
2023-04-13 23:01:48 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2023-05-10 00:04:33 +02:00
|
|
|
import 'package:hive_flutter/hive_flutter.dart';
|
|
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
|
|
|
|
|
|
|
import 'config/setup_todaybox_config.dart';
|
|
|
|
|
|
|
|
|
|
|
|
void main() async {
|
|
|
|
await dotenv.load(fileName: ".env");
|
|
|
|
await Hive.initFlutter();
|
|
|
|
|
|
|
|
if (! Hive.isAdapterRegistered(1)) {
|
|
|
|
Hive.registerAdapter(FoodAdapter());
|
|
|
|
}
|
|
|
|
|
|
|
|
await Hive.openBox(dotenv.env['TODAY_BOX']!);
|
|
|
|
await setupTodayBox();
|
2023-04-13 23:01:48 +02:00
|
|
|
|
2023-04-19 16:24:14 +02:00
|
|
|
runApp(const MyApp());
|
2023-04-13 23:01:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
class MyApp extends StatelessWidget {
|
2023-04-19 16:24:14 +02:00
|
|
|
const MyApp({super.key});
|
|
|
|
|
2023-04-13 23:01:48 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return MaterialApp(
|
|
|
|
title: 'Flutter Demo',
|
|
|
|
theme: ThemeData(
|
|
|
|
primarySwatch: Colors.blue,
|
|
|
|
),
|
2023-04-23 13:08:04 +02:00
|
|
|
home: const MainPage(),
|
2023-04-19 16:24:14 +02:00
|
|
|
routes: {
|
|
|
|
'/navigation': (context) => const NavigationScreen(),
|
2023-04-16 12:38:21 +02:00
|
|
|
},
|
2023-04-13 23:01:48 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|