diff --git a/lib/ui/app/app_bottom_bar.dart b/lib/ui/app/app_bottom_bar.dart index a70772887..281d11c04 100644 --- a/lib/ui/app/app_bottom_bar.dart +++ b/lib/ui/app/app_bottom_bar.dart @@ -12,10 +12,11 @@ import 'package:redux/redux.dart'; class AppBottomBar extends StatefulWidget { const AppBottomBar({ - this.sortFields = const [], - this.onSelectedSortField, - this.entityType, - this.onSelectedState, + @required this.sortFields, + @required this.onSelectedSortField, + @required this.entityType, + @required this.onSelectedState, + @required this.onCheckboxPressed, this.onSelectedStatus, this.onSelectedCustom1, this.onSelectedCustom2, @@ -31,6 +32,7 @@ class AppBottomBar extends StatefulWidget { final EntityType entityType; final List sortFields; final List statuses; + final Function onCheckboxPressed; final Function(String) onSelectedSortField; final Function(EntityState, bool) onSelectedState; final Function(EntityStatus, bool) onSelectedStatus; @@ -291,12 +293,8 @@ class _AppBottomBarState extends State { children: [ IconButton( tooltip: localization.multiselect, - icon: Icon(listState.isInMultiselect() - ? Icons.check_box_outline_blank - : Icons.check_box), - onPressed: () { - // - }, + icon: Icon(Icons.check_box), + onPressed: () => widget.onCheckboxPressed(), ), IconButton( tooltip: localization.switchListTable, diff --git a/lib/ui/client/client_screen.dart b/lib/ui/client/client_screen.dart index 79e5107f5..aeefc48ed 100644 --- a/lib/ui/client/client_screen.dart +++ b/lib/ui/client/client_screen.dart @@ -104,6 +104,13 @@ class ClientScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterClientsByState(state)); }, + onCheckboxPressed: () { + if (store.state.clientListState.isInMultiselect()) { + store.dispatch(ClearClientMultiselect()); + } else { + store.dispatch(StartClientMultiselect()); + } + }, customValues1: company.getCustomFieldValues(CustomFieldType.client1, excludeBlank: true), customValues2: company.getCustomFieldValues(CustomFieldType.client2, diff --git a/lib/ui/company_gateway/company_gateway_screen.dart b/lib/ui/company_gateway/company_gateway_screen.dart index b782cd261..f579fcde8 100644 --- a/lib/ui/company_gateway/company_gateway_screen.dart +++ b/lib/ui/company_gateway/company_gateway_screen.dart @@ -86,6 +86,8 @@ class CompanyGatewayScreen extends StatelessWidget { ], body: CompanyGatewayListBuilder(), bottomNavigationBar: AppBottomBar( + sortFields: [], + onSelectedSortField: null, entityType: EntityType.companyGateway, onSelectedCustom1: (value) => store.dispatch(FilterCompanyGatewaysByCustom1(value)), @@ -98,6 +100,13 @@ class CompanyGatewayScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterCompanyGatewaysByState(state)); }, + onCheckboxPressed: () { + if (store.state.companyGatewayListState.isInMultiselect()) { + store.dispatch(ClearCompanyGatewayMultiselect()); + } else { + store.dispatch(StartCompanyGatewayMultiselect()); + } + }, ), floatingActionButton: FloatingActionButton( heroTag: 'company_gateway_fab', diff --git a/lib/ui/document/document_screen.dart b/lib/ui/document/document_screen.dart index 389eea96f..6443c296d 100644 --- a/lib/ui/document/document_screen.dart +++ b/lib/ui/document/document_screen.dart @@ -109,6 +109,13 @@ class DocumentScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterDocumentsByState(state)); }, + onCheckboxPressed: () { + if (store.state.documentListState.isInMultiselect()) { + store.dispatch(ClearDocumentMultiselect()); + } else { + store.dispatch(StartDocumentMultiselect()); + } + }, ), floatingActionButton: userCompany.canCreate(EntityType.document) ? FloatingActionButton( diff --git a/lib/ui/expense/expense_screen.dart b/lib/ui/expense/expense_screen.dart index d84486a3d..b390208c3 100644 --- a/lib/ui/expense/expense_screen.dart +++ b/lib/ui/expense/expense_screen.dart @@ -137,6 +137,13 @@ class ExpenseScreen extends StatelessWidget { onSelectedStatus: (EntityStatus status, value) { store.dispatch(FilterExpensesByStatus(status)); }, + onCheckboxPressed: () { + if (store.state.expenseListState.isInMultiselect()) { + store.dispatch(ClearExpenseMultiselect()); + } else { + store.dispatch(StartExpenseMultiselect()); + } + }, ), floatingActionButton: userCompany.canCreate(EntityType.expense) ? FloatingActionButton( diff --git a/lib/ui/group/group_screen.dart b/lib/ui/group/group_screen.dart index d7c98b78a..58e5747bb 100644 --- a/lib/ui/group/group_screen.dart +++ b/lib/ui/group/group_screen.dart @@ -110,6 +110,13 @@ class GroupSettingsScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterGroupsByState(state)); }, + onCheckboxPressed: () { + if (store.state.groupListState.isInMultiselect()) { + store.dispatch(ClearGroupMultiselect()); + } else { + store.dispatch(StartGroupMultiselect()); + } + }, ), floatingActionButton: state.userCompany.canCreate(EntityType.group) ? FloatingActionButton( diff --git a/lib/ui/invoice/invoice_screen.dart b/lib/ui/invoice/invoice_screen.dart index cbed5e177..af7041f22 100644 --- a/lib/ui/invoice/invoice_screen.dart +++ b/lib/ui/invoice/invoice_screen.dart @@ -152,6 +152,13 @@ class InvoiceScreen extends StatelessWidget { ..name = localization.pastDue, ), ], + onCheckboxPressed: () { + if (store.state.invoiceListState.isInMultiselect()) { + store.dispatch(ClearInvoiceMultiselect()); + } else { + store.dispatch(StartInvoiceMultiselect()); + } + }, ), floatingActionButton: userCompany.canCreate(EntityType.invoice) ? FloatingActionButton( diff --git a/lib/ui/payment/payment_screen.dart b/lib/ui/payment/payment_screen.dart index 413aae144..b047a4860 100644 --- a/lib/ui/payment/payment_screen.dart +++ b/lib/ui/payment/payment_screen.dart @@ -115,6 +115,13 @@ class PaymentScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterPaymentsByState(state)); }, + onCheckboxPressed: () { + if (store.state.paymentListState.isInMultiselect()) { + store.dispatch(ClearPaymentMultiselect()); + } else { + store.dispatch(StartPaymentMultiselect()); + } + }, ), floatingActionButton: userCompany.canCreate(EntityType.payment) ? FloatingActionButton( diff --git a/lib/ui/product/product_screen.dart b/lib/ui/product/product_screen.dart index 1cee93f19..13e7521e3 100644 --- a/lib/ui/product/product_screen.dart +++ b/lib/ui/product/product_screen.dart @@ -115,6 +115,13 @@ class ProductScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterProductsByState(state)); }, + onCheckboxPressed: () { + if (store.state.productListState.isInMultiselect()) { + store.dispatch(ClearProductMultiselect()); + } else { + store.dispatch(StartProductMultiselect()); + } + }, ), floatingActionButton: userCompany.canCreate(EntityType.product) ? FloatingActionButton( diff --git a/lib/ui/project/project_screen.dart b/lib/ui/project/project_screen.dart index 7f40dbba0..0c705ecc8 100644 --- a/lib/ui/project/project_screen.dart +++ b/lib/ui/project/project_screen.dart @@ -116,6 +116,13 @@ class ProjectScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterProjectsByState(state)); }, + onCheckboxPressed: () { + if (store.state.projectListState.isInMultiselect()) { + store.dispatch(ClearProjectMultiselect()); + } else { + store.dispatch(StartProjectMultiselect()); + } + }, ), floatingActionButton: userCompany.canCreate(EntityType.project) ? FloatingActionButton( diff --git a/lib/ui/quote/quote_screen.dart b/lib/ui/quote/quote_screen.dart index bbcdc05b5..dd23bbde3 100644 --- a/lib/ui/quote/quote_screen.dart +++ b/lib/ui/quote/quote_screen.dart @@ -145,6 +145,13 @@ class QuoteScreen extends StatelessWidget { ..name = localization.expired, ), ], + onCheckboxPressed: () { + if (store.state.quoteListState.isInMultiselect()) { + store.dispatch(ClearQuoteMultiselect()); + } else { + store.dispatch(StartQuoteMultiselect()); + } + }, ), floatingActionButton: userCompany.canCreate(EntityType.quote) ? FloatingActionButton( diff --git a/lib/ui/task/task_screen.dart b/lib/ui/task/task_screen.dart index 1e903e792..f7cd57c44 100644 --- a/lib/ui/task/task_screen.dart +++ b/lib/ui/task/task_screen.dart @@ -135,6 +135,13 @@ class TaskScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterTasksByState(state)); }, + onCheckboxPressed: () { + if (store.state.taskListState.isInMultiselect()) { + store.dispatch(ClearTaskMultiselect()); + } else { + store.dispatch(StartTaskMultiselect()); + } + }, ), floatingActionButton: userCompany.canCreate(EntityType.task) ? FloatingActionButton( diff --git a/lib/ui/tax_rate/tax_rate_screen.dart b/lib/ui/tax_rate/tax_rate_screen.dart index 51209bbf1..48bf9692e 100644 --- a/lib/ui/tax_rate/tax_rate_screen.dart +++ b/lib/ui/tax_rate/tax_rate_screen.dart @@ -102,6 +102,13 @@ class TaxRateSettingsScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterTaxRatesByState(state)); }, + onCheckboxPressed: () { + if (store.state.taxRateListState.isInMultiselect()) { + store.dispatch(ClearTaxRateMultiselect()); + } else { + store.dispatch(StartTaxRateMultiselect()); + } + }, ), floatingActionButton: state.userCompany.canCreate(EntityType.taxRate) ? FloatingActionButton( diff --git a/lib/ui/user/user_screen.dart b/lib/ui/user/user_screen.dart index 9d7f11eb3..87f9521ba 100644 --- a/lib/ui/user/user_screen.dart +++ b/lib/ui/user/user_screen.dart @@ -109,6 +109,13 @@ class UserScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterUsersByState(state)); }, + onCheckboxPressed: () { + if (store.state.userListState.isInMultiselect()) { + store.dispatch(ClearUserMultiselect()); + } else { + store.dispatch(StartUserMultiselect()); + } + }, ), floatingActionButton: userCompany.canCreate(EntityType.user) ? FloatingActionButton( diff --git a/lib/ui/vendor/vendor_screen.dart b/lib/ui/vendor/vendor_screen.dart index dad5873c0..3e7f91467 100644 --- a/lib/ui/vendor/vendor_screen.dart +++ b/lib/ui/vendor/vendor_screen.dart @@ -116,6 +116,13 @@ class VendorScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterVendorsByState(state)); }, + onCheckboxPressed: () { + if (store.state.vendorListState.isInMultiselect()) { + store.dispatch(ClearVendorMultiselect()); + } else { + store.dispatch(StartVendorMultiselect()); + } + }, ), floatingActionButton: userCompany.canCreate(EntityType.vendor) ? FloatingActionButton( diff --git a/stubs/ui/stub/stub_screen b/stubs/ui/stub/stub_screen index a6d2f2f47..56e5ca61e 100644 --- a/stubs/ui/stub/stub_screen +++ b/stubs/ui/stub/stub_screen @@ -104,6 +104,13 @@ class StubScreen extends StatelessWidget { onSelectedState: (EntityState state, value) { store.dispatch(FilterStubsByState(state)); }, + onCheckboxPressed: () { + if (store.state.stubListState.isInMultiselect()) { + store.dispatch(ClearStubMultiselect()); + } else { + store.dispatch(StartStubMultiselect()); + } + }, ), floatingActionButton: user.canCreate(EntityType.stub) ? FloatingActionButton(