-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.dart
62 lines (59 loc) · 2.12 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
import 'package:flutter/material.dart';
import 'package:redux/redux.dart';
import 'package:flutter_redux/flutter_redux.dart';
//MyCode
import "package:waterledger/models/appState.dart";
import 'package:waterledger/pages/loadingPage.dart';
import 'package:waterledger/pages/loginPage.dart';
import 'package:waterledger/pages/homePage.dart';
import 'package:waterledger/redux/actions.dart';
import "package:waterledger/redux/appReducer.dart";
import 'package:waterledger/redux/authMiddleware.dart';
import 'package:waterledger/redux/dataMiddleware.dart';
import 'package:waterledger/redux/generalMiddleware.dart';
import 'package:waterledger/redux/navigationMiddleware.dart';
import 'package:waterledger/redux/notifMiddleware.dart';
import 'package:waterledger/dialogs/addEntry.dart';
import 'package:waterledger/dialogs/legal.dart';
//TODO: add rate request
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
static final GlobalKey<NavigatorState> navigatorKey =
GlobalKey<NavigatorState>();
final store = new Store<AppState>(appReducer,
initialState: new AppState.initial(),
middleware: [
general,
googleSignIn,
facebookSignIn,
twitterSignIn,
signOut,
loadingAuth,
DataHandler(),
NotifHandler(),
navigationMiddleware(navigatorKey)
]);
@override
Widget build(BuildContext context) {
store.dispatch(LoadingAction());
return StoreProvider(
store: store,
child: MaterialApp(
navigatorKey: navigatorKey,
title: 'Water Ledger',
theme: ThemeData(
primaryColor: Colors.lightBlue[300],
),
home: LoadingPage(),
//TODO: figure out a clean way to do edit entry dialog. Next Version
routes: <String, WidgetBuilder>{
'/home': (BuildContext context) => HomePage(),
'/login': (BuildContext context) => LoginPage(),
'/loading': (BuildContext context) => LoadingPage(),
'/addEntryDialog': (BuildContext context) => AddEntryDialog(),
'/legalDialog': (BuildContext context) => LegalDialog(),
},
),
);
}
}