This commit is contained in:
unknown 2018-07-01 03:54:59 -07:00
parent 573f7bb377
commit a64253b9b0
2 changed files with 33 additions and 28 deletions

View File

@ -83,10 +83,10 @@ class AppDrawer extends StatelessWidget {
Row(
children: <Widget>[
Expanded(
child: viewModel.companies.length > 1 && ! viewModel.isLoading
child: viewModel.companies.length > 1 &&
!viewModel.isLoading
? _multipleCompanies
: _singleCompany
),
: _singleCompany),
],
),
],
@ -107,7 +107,8 @@ class AppDrawer extends StatelessWidget {
onTap: () => navigator.pushReplacementNamed(ClientScreen.route),
onCreateTap: () {
navigator.pop();
store.dispatch(EditClient(client: ClientEntity(), context: context));
store.dispatch(
EditClient(client: ClientEntity(), context: context));
},
),
DrawerTile(
@ -116,7 +117,8 @@ class AppDrawer extends StatelessWidget {
onTap: () => navigator.pushReplacementNamed(ProductScreen.route),
onCreateTap: () {
navigator.pop();
store.dispatch(EditProduct(product: ProductEntity(), context: context));
store.dispatch(
EditProduct(product: ProductEntity(), context: context));
},
),
DrawerTile(
@ -125,7 +127,8 @@ class AppDrawer extends StatelessWidget {
onTap: () => navigator.pushReplacementNamed(InvoiceScreen.route),
onCreateTap: () {
navigator.pop();
store.dispatch(EditInvoice(invoice: InvoiceEntity(), context: context));
store.dispatch(
EditInvoice(invoice: InvoiceEntity(), context: context));
},
),
DrawerTile(
@ -171,7 +174,9 @@ class DrawerTile extends StatelessWidget {
leading: Icon(icon, size: 22.0),
title: Text(title),
onTap: () => onTap(),
trailing: onCreateTap == null ? null : IconButton(
trailing: onCreateTap == null
? null
: IconButton(
icon: Icon(Icons.add_circle_outline),
onPressed: onCreateTap,
),

View File

@ -45,11 +45,11 @@ class _EntityDropdownState extends State<EntityDropdown> {
super.dispose();
}
_showOptions() {
void _showOptions() {
widget.onFilterChanged('');
var localization = AppLocalization.of(context);
_headerRow() {
Widget _headerRow() {
return Row(
children: <Widget>[
Padding(
@ -70,27 +70,27 @@ class _EntityDropdownState extends State<EntityDropdown> {
),
),
IconButton(
icon: Icon(Icons.close),
icon: const Icon(Icons.close),
onPressed: () => Navigator.pop(context),
)
],
);
}
_entityList(store) {
Widget _entityList(Store<AppState> store) {
return Column(
mainAxisSize: MainAxisSize.min,
children: widget.entityList
.getRange(0, min(6, widget.entityList.length))
.map((entityId) {
var entity = widget.entityMap[entityId];
var filter =
final entity = widget.entityMap[entityId];
final filter =
store.state.getUIState(widget.entityType).dropdownFilter;
var subtitle = null;
var matchField = entity.matchesSearchField(filter);
String subtitle;
final matchField = entity.matchesSearchField(filter);
if (matchField != null) {
var field = localization.lookup(matchField);
var value = entity.matchesSearchValue(filter);
final field = localization.lookup(matchField);
final value = entity.matchesSearchValue(filter);
subtitle = '$field: $value';
}
return ListTile(
@ -141,7 +141,7 @@ class _EntityDropdownState extends State<EntityDropdown> {
controller: _textController,
decoration: InputDecoration(
labelText: widget.labelText,
suffixIcon: Icon(Icons.search),
suffixIcon: const Icon(Icons.search),
),
),
),