-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
67 lines (60 loc) · 2.09 KB
/
main.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
import 'package:findgamemates/get/initial_bindings.dart';
import 'package:findgamemates/model/app_user.dart';
import 'package:findgamemates/screen/games_screen.dart';
import 'package:findgamemates/screen/intro_screen.dart';
import 'package:findgamemates/screen/profile_screen.dart';
import 'package:findgamemates/screen/settings_screen.dart';
import 'package:findgamemates/theme_data.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_platform_widgets/flutter_platform_widgets.dart';
import 'package:get/get.dart';
import 'package:hive_flutter/hive_flutter.dart';
import 'data/database/settings_database.dart';
void main() async {
//todo : sunu bi incele
await licenses();
registerAdapters();
await initHiveBoxes();
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
InitialBindings().dependencies();
runApp(const MyApp());
}
Future licenses() async{
LicenseRegistry.addLicense(() async* {
final license = await rootBundle.loadString('google_fonts/OFL.txt');
yield LicenseEntryWithLineBreaks(['google_fonts'], license);
});
}
void registerAdapters(){
Hive.registerAdapter(AppUserAdapter());
}
Future initHiveBoxes() async{
await Hive.initFlutter();
await Hive.openBox("user");
await Hive.openBox("settings");
return;
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
SettingsDatabase settingsDatabase = Get.put(SettingsDatabase());
return PlatformApp(
home: GetMaterialApp(
title: 'Flutter Demo',
initialBinding: InitialBindings(),
routes: {
'/games' : (context) => const GamesScreen(),
'/settings' : (context) => const SettingsScreen(),
'profile' : (context) => const ProfileScreen()
},
theme: settingsDatabase.isDarkMode() ? CustomThemeData().darkTheme : CustomThemeData().lightTheme,
home: const IntroScreen(),
),
);
}
}