From 9c31b7ca8018184cf8425623f40c9efeddbdb2cc Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 1 Jun 2018 04:48:50 -0700 Subject: [PATCH] Refactor --- lib/main.dart | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/main.dart b/lib/main.dart index 8682d708e..6e57b5afd 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -6,7 +6,6 @@ import 'package:redux_logging/redux_logging.dart'; import 'package:invoiceninja/routes.dart'; import 'package:invoiceninja/ui/auth/login_vm.dart'; import 'package:invoiceninja/ui/dashboard/dashboard.dart'; -import 'package:invoiceninja/ui/client/clients.dart'; import 'package:invoiceninja/ui/product/product_screen.dart'; import 'package:invoiceninja/redux/app/app_reducer.dart'; import 'package:invoiceninja/redux/app/app_state.dart'; @@ -20,7 +19,6 @@ import 'package:invoiceninja/utils/localization.dart'; void main() { - final store = Store( appReducer, initialState: AppState(), @@ -36,20 +34,21 @@ void main() { runApp(new InvoiceNinjaApp(store: store)); } -class InvoiceNinjaApp extends StatelessWidget { +class InvoiceNinjaApp extends StatefulWidget { final Store store; InvoiceNinjaApp({Key key, this.store}) : super(key: key); + @override + _InvoiceNinjaAppState createState() => new _InvoiceNinjaAppState(); +} + +class _InvoiceNinjaAppState extends State { @override Widget build(BuildContext context) { - // The StoreProvider should wrap your MaterialApp or WidgetsApp. This will - // ensure all routes have access to the store. return new StoreProvider( - // Pass the store to the StoreProvider. Any ancestor `StoreConnector` - // Widgets will find and use this value as the `Store`. - store: store, + store: widget.store, child: new MaterialApp( debugShowCheckedModeBanner: false, localizationsDelegates: [ @@ -85,6 +84,7 @@ class InvoiceNinjaApp extends StatelessWidget { }, ); }, + /* AppRoutes.clients: (context) { return StoreBuilder( builder: (context, store) { @@ -92,6 +92,7 @@ class InvoiceNinjaApp extends StatelessWidget { }, ); }, + */ AppRoutes.products: (context) { return StoreBuilder( onInit: (store) => store.state.productState().isStale() ? store.dispatch(LoadProductsAction()) : null,