Search
This commit is contained in:
parent
4a4f6bbb3a
commit
a2a1226e11
|
|
@ -16,7 +16,7 @@ import 'package:invoiceninja/redux/dashboard/dashboard_middleware.dart';
|
|||
import 'package:invoiceninja/redux/product/product_actions.dart';
|
||||
import 'package:invoiceninja/redux/product/product_middleware.dart';
|
||||
import 'package:invoiceninja/utils/localization.dart';
|
||||
import 'package:redux_logging/redux_logging.dart';
|
||||
//import 'package:redux_logging/redux_logging.dart';
|
||||
|
||||
void main() {
|
||||
final store = Store<AppState>(appReducer,
|
||||
|
|
@ -27,7 +27,7 @@ void main() {
|
|||
..addAll(createStoreProductsMiddleware())
|
||||
..addAll(createStorePersistenceMiddleware())
|
||||
..addAll([
|
||||
LoggingMiddleware.printer(),
|
||||
//LoggingMiddleware.printer(),
|
||||
]));
|
||||
|
||||
runApp(new InvoiceNinjaApp(store: store));
|
||||
|
|
@ -76,7 +76,7 @@ class _InvoiceNinjaAppState extends State<InvoiceNinjaApp> {
|
|||
return DashboardScreen();
|
||||
},
|
||||
AppRoutes.products: (context) {
|
||||
print('== ROUTES ===');
|
||||
print('== LODING ROUTE ==');
|
||||
widget.store.dispatch(LoadProductsAction());
|
||||
return ProductScreen();
|
||||
},
|
||||
|
|
|
|||
|
|
@ -106,8 +106,6 @@ Middleware<AppState> _saveProduct(ProductsRepository repository) {
|
|||
Middleware<AppState> _loadProducts(ProductsRepository repository) {
|
||||
return (Store<AppState> store, action, NextDispatcher next) {
|
||||
|
||||
//store.dispatch(SearchProducts(null));
|
||||
|
||||
if (! store.state.productState().isStale() && ! action.force) {
|
||||
next(action);
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_redux/flutter_redux.dart';
|
||||
import 'package:invoiceninja/constants.dart';
|
||||
import 'package:invoiceninja/redux/app/app_state.dart';
|
||||
import 'package:invoiceninja/redux/product/product_actions.dart';
|
||||
import 'package:invoiceninja/routes.dart';
|
||||
import 'package:invoiceninja/data/models/entities.dart';
|
||||
import 'package:invoiceninja/ui/app/app_drawer_vm.dart';
|
||||
|
|
@ -85,6 +88,7 @@ class AppDrawer extends StatelessWidget {
|
|||
leading: Icon(FontAwesomeIcons.cube),
|
||||
title: Text(AppLocalization.of(context).products),
|
||||
onTap: () {
|
||||
StoreProvider.of<AppState>(context).dispatch(SearchProducts(null));
|
||||
Navigator.of(context).pushReplacementNamed(AppRoutes.products);
|
||||
},
|
||||
),
|
||||
|
|
|
|||
|
|
@ -37,7 +37,6 @@ class AppSearch extends StatelessWidget {
|
|||
border: Border.all(color: Colors.grey[700], width: 1.0),
|
||||
borderRadius: BorderRadius.circular(6.0)),
|
||||
child: TextField(
|
||||
|
||||
decoration: InputDecoration(
|
||||
prefixIcon: Padding(
|
||||
padding: EdgeInsets.only(right: 8.0),
|
||||
|
|
|
|||
|
|
@ -16,21 +16,13 @@ class AppSearchButton extends StatelessWidget {
|
|||
return StoreConnector<AppState, ListUIState>(
|
||||
converter: (Store<AppState> store) =>
|
||||
store.state.productListState(),
|
||||
//distinct: true,
|
||||
distinct: true,
|
||||
builder: (BuildContext context, listUIState) {
|
||||
return listUIState.search == null
|
||||
? IconButton(
|
||||
icon: Icon(Icons.search),
|
||||
return IconButton(
|
||||
icon: Icon(listUIState.search == null ? Icons.search : Icons.close),
|
||||
tooltip: localization.search,
|
||||
onPressed: () {
|
||||
store.dispatch(SearchProducts(''));
|
||||
},
|
||||
)
|
||||
: IconButton(
|
||||
icon: Icon(Icons.close),
|
||||
tooltip: localization.close,
|
||||
onPressed: () {
|
||||
store.dispatch(SearchProducts(null));
|
||||
store.dispatch(SearchProducts(listUIState.search == null ? '' : null));
|
||||
},
|
||||
);
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in New Issue