-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
60 lines (53 loc) · 1.6 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
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:overlay_support/overlay_support.dart';
import 'package:quiz_app/firebase_options.dart';
import 'package:quiz_app/screen/home.dart';
import 'package:quiz_app/screen/login.dart';
import 'package:quiz_app/screen/loser.dart';
import 'package:quiz_app/screen/profile.dart';
import 'package:quiz_app/screen/question.dart';
import 'package:quiz_app/screen/quizintro.dart';
import 'package:quiz_app/screen/win.dart';
import 'package:quiz_app/services/localdb.dart';
import 'package:quiz_app/widgets/lifeline_sidebar.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
bool isLogIn = false;
getLoggedInState() async {
await LocalDB.getuserID().then((value) {
setState(() {
isLogIn = value.toString() != "null";
});
});
}
@override
void initState() {
super.initState();
getLoggedInState();
}
@override
Widget build(BuildContext context) {
return OverlaySupport.global(
child: MaterialApp(
debugShowCheckedModeBanner: false,
title: 'KBC Quiz',
theme: ThemeData(
primarySwatch: Colors.deepPurple,
),
home: isLogIn ? Home() : Login(),
),
);
}
}