From c270610c5bc68f6167ae862bc9124d43de429b43 Mon Sep 17 00:00:00 2001 From: unknown Date: Sun, 3 Jun 2018 05:04:08 -0700 Subject: [PATCH] Fix for bottom sheet --- lib/main.dart | 55 +++++++++++++++++++-------------------------------- 1 file changed, 20 insertions(+), 35 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 419eaead7..8dae6aa1e 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -18,8 +18,7 @@ import 'package:invoiceninja/utils/localization.dart'; //import 'package:redux_logging/redux_logging.dart'; void main() { - final store = Store( - appReducer, + final store = Store(appReducer, initialState: AppState(), middleware: [] ..addAll(createStoreAuthMiddleware()) @@ -27,14 +26,12 @@ void main() { ..addAll(createStoreProductsMiddleware()) ..addAll([ //LoggingMiddleware.printer(), - ]) - ); + ])); runApp(new InvoiceNinjaApp(store: store)); } -class InvoiceNinjaApp extends StatefulWidget { - +class InvoiceNinjaApp extends StatefulWidget { final Store store; InvoiceNinjaApp({Key key, this.store}) : super(key: key); @@ -49,11 +46,11 @@ class _InvoiceNinjaAppState extends State { return new StoreProvider( store: widget.store, child: new MaterialApp( - debugShowCheckedModeBanner: false, - localizationsDelegates: [ - const AppLocalizationsDelegate(), - GlobalMaterialLocalizations.delegate, - ], + debugShowCheckedModeBanner: false, + localizationsDelegates: [ + const AppLocalizationsDelegate(), + GlobalMaterialLocalizations.delegate, + ], theme: ThemeData().copyWith( primaryColor: const Color(0xFF117cc1), primaryColorDark: const Color(0xFF005090), @@ -68,34 +65,22 @@ class _InvoiceNinjaAppState extends State { title: 'Invoice Ninja', routes: { AppRoutes.login: (context) { - return StoreBuilder( - onInit: (store) => store.dispatch(LoadUserLogin()), - builder: (context, store) { - return LoginVM(); - }, - ); + StoreProvider.of(context).dispatch(LoadUserLogin()); + return LoginVM(); }, AppRoutes.dashboard: (context) { - return StoreBuilder( - onInit: (store) => store.dispatch(LoadDashboardAction()), - builder: (context, store) { - return Dashboard(); - }, - ); + StoreProvider.of(context).dispatch(LoadDashboardAction()); + return Dashboard(); }, - /* - AppRoutes.clients: (context) { - return StoreBuilder( - builder: (context, store) { - return ClientList(); - }, - ); - }, - */ AppRoutes.products: (context) { - if (StoreProvider.of(context).state.productState().isStale()) { - StoreProvider.of(context).dispatch( - LoadProductsAction()); + if (StoreProvider + .of(context) + .state + .productState() + .isStale()) { + StoreProvider + .of(context) + .dispatch(LoadProductsAction()); } return ProductScreen(); },