-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.dart
37 lines (34 loc) · 1.02 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
import 'package:flutter/material.dart';
import 'package:flutter_chat_app/pages/home_page.dart';
import 'package:flutter_chat_app/pages/registration_page.dart';
import 'package:shared_preferences/shared_preferences.dart';
// import 'package:firebase_messaging/firebase_messaging.dart';
void main() {
WidgetsFlutterBinding.ensureInitialized();
SharedPreferences.getInstance().then((prefs) {
runApp(LandingPage(prefs: prefs));
});
}
class LandingPage extends StatelessWidget {
final SharedPreferences prefs;
LandingPage({this.prefs});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: _decideMainPage(),
);
}
_decideMainPage() {
if (prefs.getBool('is_verified') != null) {
if (prefs.getBool('is_verified')) {
return HomePage(prefs: prefs);
// return RegistrationPage(prefs: prefs);
} else {
return RegistrationPage(prefs: prefs);
}
} else {
return RegistrationPage(prefs: prefs);
}
}
}