Company search
This commit is contained in:
parent
4c7e3a954f
commit
8cc3a47ae8
|
|
@ -1,6 +1,7 @@
|
|||
import 'package:invoiceninja_flutter/redux/app/app_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/client/client_reducer.dart';
|
||||
import 'package:invoiceninja_flutter/redux/company/company_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/dashboard/dashboard_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/ui_actions.dart';
|
||||
import 'package:invoiceninja_flutter/redux/ui/ui_state.dart';
|
||||
import 'package:invoiceninja_flutter/redux/product/product_reducer.dart';
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
|||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
import 'package:redux/redux.dart';
|
||||
|
||||
class ListFilter extends StatelessWidget {
|
||||
class ListFilter extends StatefulWidget {
|
||||
final EntityType entityType;
|
||||
final String filter;
|
||||
final String title;
|
||||
|
|
@ -18,6 +18,26 @@ class ListFilter extends StatelessWidget {
|
|||
this.onFilterChanged,
|
||||
});
|
||||
|
||||
@override
|
||||
_ListFilterState createState() => new _ListFilterState();
|
||||
}
|
||||
|
||||
class _ListFilterState extends State<ListFilter> {
|
||||
|
||||
final _filterController = TextEditingController();
|
||||
|
||||
@override
|
||||
void didChangeDependencies() {
|
||||
super.didChangeDependencies();
|
||||
_filterController.text = widget.filter;
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_filterController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final localization = AppLocalization.of(context);
|
||||
|
|
@ -25,12 +45,13 @@ class ListFilter extends StatelessWidget {
|
|||
return StoreConnector<AppState, AppState>(
|
||||
converter: (Store<AppState> store) => store.state,
|
||||
builder: (BuildContext context, state) {
|
||||
final entityType = widget.entityType;
|
||||
final filter = entityType != null
|
||||
? state.getListState(entityType).filter
|
||||
: state.uiState.filter;
|
||||
final bool enableDarkMode = state.uiState.enableDarkMode;
|
||||
return filter == null
|
||||
? Text(title ?? localization.lookup(entityType.plural.toString()))
|
||||
? Text(widget.title ?? localization.lookup(entityType.plural.toString()))
|
||||
: Container(
|
||||
padding: const EdgeInsets.only(left: 8.0),
|
||||
height: 38.0,
|
||||
|
|
@ -57,7 +78,8 @@ class ListFilter extends StatelessWidget {
|
|||
hintText: localization.filter),
|
||||
autofocus: true,
|
||||
autocorrect: false,
|
||||
onChanged: (value) => onFilterChanged(value),
|
||||
onChanged: (value) => widget.onFilterChanged(value),
|
||||
controller: _filterController,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ class _DashboardViewState extends State<DashboardView>
|
|||
drawer: AppDrawerBuilder(),
|
||||
appBar: AppBar(
|
||||
title: ListFilter(
|
||||
filter: widget.viewModel.filter,
|
||||
title: AppLocalization.of(context).dashboard,
|
||||
onFilterChanged: (value) {
|
||||
store.dispatch(FilterCompany(value));
|
||||
|
|
@ -65,7 +66,7 @@ class _DashboardViewState extends State<DashboardView>
|
|||
},
|
||||
),
|
||||
],
|
||||
bottom: TabBar(
|
||||
bottom: store.state.uiState.filter != null ? null : TabBar(
|
||||
controller: _controller,
|
||||
tabs: [
|
||||
Tab(
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ import 'package:invoiceninja_flutter/data/models/models.dart';
|
|||
|
||||
IconData getIconData(EntityType entityType) {
|
||||
switch (entityType) {
|
||||
case EntityType.product:
|
||||
return FontAwesomeIcons.cube;
|
||||
case EntityType.client:
|
||||
return FontAwesomeIcons.users;
|
||||
case EntityType.invoice:
|
||||
|
|
|
|||
Loading…
Reference in New Issue