diff --git a/lib/ui/app/app_scaffold.dart b/lib/ui/app/app_scaffold.dart index e29186222..41ba1aefe 100644 --- a/lib/ui/app/app_scaffold.dart +++ b/lib/ui/app/app_scaffold.dart @@ -18,6 +18,7 @@ class AppScaffold extends StatelessWidget { this.floatingActionButton, this.isChecked, this.onCheckboxChanged, + this.onHamburgerLongPress, this.showCheckbox = false, this.hideHamburgerButton = false}); @@ -29,6 +30,7 @@ class AppScaffold extends StatelessWidget { final bool hideHamburgerButton; final bool showCheckbox; final Function(bool) onCheckboxChanged; + final Function() onHamburgerLongPress; final bool isChecked; @override @@ -43,20 +45,30 @@ class AppScaffold extends StatelessWidget { child: Scaffold( drawer: isMobile(context) ? AppDrawerBuilder() : null, appBar: AppBar( - automaticallyImplyLeading: isMobile(context), + automaticallyImplyLeading: false, leading: showCheckbox ? Checkbox( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, onChanged: onCheckboxChanged, activeColor: Theme.of(context).accentColor, value: isChecked) - : hideHamburgerButton || isMobile(context) + : hideHamburgerButton ? null - : IconButton( - icon: Icon(Icons.menu), - onPressed: () => - store.dispatch(UpdateSidebar(AppSidebar.menu)), - ), + : Builder( + builder: (context) => GestureDetector( + onLongPress: onHamburgerLongPress, + child: IconButton( + icon: Icon(Icons.menu), + onPressed: () { + if (isMobile(context)) { + Scaffold.of(context).openDrawer(); + } else { + store.dispatch( + UpdateSidebar(AppSidebar.menu)); + } + }, + ), + )), title: appBarTitle, actions: appBarActions, ), diff --git a/lib/ui/client/client_screen.dart b/lib/ui/client/client_screen.dart index bf7706ef0..e0c122ccc 100644 --- a/lib/ui/client/client_screen.dart +++ b/lib/ui/client/client_screen.dart @@ -37,6 +37,8 @@ class ClientScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.clientList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartClientMultiselect(context: context)), onCheckboxChanged: (value) { final clients = viewModel.clientList .map((clientId) => viewModel.clientMap[clientId]) diff --git a/lib/ui/company_gateway/company_gateway_screen.dart b/lib/ui/company_gateway/company_gateway_screen.dart index 547edaf7b..bfd419b33 100644 --- a/lib/ui/company_gateway/company_gateway_screen.dart +++ b/lib/ui/company_gateway/company_gateway_screen.dart @@ -38,6 +38,8 @@ class CompanyGatewayScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.companyGatewayList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartCompanyGatewayMultiselect(context: context)), onCheckboxChanged: (value) { final companyGateways = viewModel.companyGatewayList .map((companyGatewayId) => diff --git a/lib/ui/document/document_screen.dart b/lib/ui/document/document_screen.dart index 5afbfc799..50f399ee2 100644 --- a/lib/ui/document/document_screen.dart +++ b/lib/ui/document/document_screen.dart @@ -36,6 +36,8 @@ class DocumentScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.documentList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartDocumentMultiselect(context: context)), onCheckboxChanged: (value) { final documents = viewModel.documentList .map( diff --git a/lib/ui/expense/expense_screen.dart b/lib/ui/expense/expense_screen.dart index 7a8e2ba0d..b4eea4584 100644 --- a/lib/ui/expense/expense_screen.dart +++ b/lib/ui/expense/expense_screen.dart @@ -38,6 +38,8 @@ class ExpenseScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.expenseList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartExpenseMultiselect(context: context)), onCheckboxChanged: (value) { final expenses = viewModel.expenseList .map((expenseId) => viewModel.expenseMap[expenseId]) diff --git a/lib/ui/group/group_screen.dart b/lib/ui/group/group_screen.dart index 1ae8764d6..1d0176492 100644 --- a/lib/ui/group/group_screen.dart +++ b/lib/ui/group/group_screen.dart @@ -39,6 +39,8 @@ class GroupSettingsScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.groupList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartGroupMultiselect(context: context)), onCheckboxChanged: (value) { final groups = viewModel.groupList .map((groupId) => viewModel.groupMap[groupId]) diff --git a/lib/ui/invoice/invoice_screen.dart b/lib/ui/invoice/invoice_screen.dart index e8bb9f153..5137331bf 100644 --- a/lib/ui/invoice/invoice_screen.dart +++ b/lib/ui/invoice/invoice_screen.dart @@ -38,6 +38,8 @@ class InvoiceScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.invoiceList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartInvoiceMultiselect(context: context)), onCheckboxChanged: (value) { final invoices = viewModel.invoiceList .map((invoiceId) => viewModel.invoiceMap[invoiceId]) diff --git a/lib/ui/payment/payment_screen.dart b/lib/ui/payment/payment_screen.dart index 6193de30b..4b31e9ecf 100644 --- a/lib/ui/payment/payment_screen.dart +++ b/lib/ui/payment/payment_screen.dart @@ -34,6 +34,8 @@ class PaymentScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.paymentList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartPaymentMultiselect(context: context)), onCheckboxChanged: (value) { final payments = viewModel.paymentList .map((paymentId) => viewModel.paymentMap[paymentId]) diff --git a/lib/ui/product/product_screen.dart b/lib/ui/product/product_screen.dart index bfde6901a..3882699f9 100644 --- a/lib/ui/product/product_screen.dart +++ b/lib/ui/product/product_screen.dart @@ -36,6 +36,8 @@ class ProductScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.productList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartProductMultiselect(context: context)), onCheckboxChanged: (value) { final products = viewModel.productList .map((productId) => viewModel.productMap[productId]) diff --git a/lib/ui/project/project_screen.dart b/lib/ui/project/project_screen.dart index b46fc57c1..6494edd98 100644 --- a/lib/ui/project/project_screen.dart +++ b/lib/ui/project/project_screen.dart @@ -36,6 +36,8 @@ class ProjectScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.projectList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartProjectMultiselect(context: context)), onCheckboxChanged: (value) { final projects = viewModel.projectList .map((projectId) => viewModel.projectMap[projectId]) diff --git a/lib/ui/quote/quote_screen.dart b/lib/ui/quote/quote_screen.dart index df17d4445..2808b3b97 100644 --- a/lib/ui/quote/quote_screen.dart +++ b/lib/ui/quote/quote_screen.dart @@ -38,6 +38,8 @@ class QuoteScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.quoteList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartQuoteMultiselect(context: context)), onCheckboxChanged: (value) { final quotes = viewModel.quoteList .map((quoteId) => viewModel.quoteMap[quoteId]) diff --git a/lib/ui/task/task_screen.dart b/lib/ui/task/task_screen.dart index fc298a70a..8f06e3bfc 100644 --- a/lib/ui/task/task_screen.dart +++ b/lib/ui/task/task_screen.dart @@ -37,6 +37,8 @@ class TaskScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.taskList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartTaskMultiselect(context: context)), onCheckboxChanged: (value) { final tasks = viewModel.taskList .map((taskId) => viewModel.taskMap[taskId]) diff --git a/lib/ui/tax_rate/tax_rate_screen.dart b/lib/ui/tax_rate/tax_rate_screen.dart index 8b1f62eaa..133bba0cd 100644 --- a/lib/ui/tax_rate/tax_rate_screen.dart +++ b/lib/ui/tax_rate/tax_rate_screen.dart @@ -36,6 +36,8 @@ class TaxRateSettingsScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.taxRateList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartTaxRateMultiselect(context: context)), onCheckboxChanged: (value) { final taxRates = viewModel.taxRateList .map((taxRateId) => viewModel.taxRateMap[taxRateId]) diff --git a/lib/ui/user/user_screen.dart b/lib/ui/user/user_screen.dart index 2828e36dc..0f24e45fd 100644 --- a/lib/ui/user/user_screen.dart +++ b/lib/ui/user/user_screen.dart @@ -37,6 +37,8 @@ class UserScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.userList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartUserMultiselect(context: context)), onCheckboxChanged: (value) { /* final users = viewModel.userList diff --git a/lib/ui/vendor/vendor_screen.dart b/lib/ui/vendor/vendor_screen.dart index ed631f7ee..1f14d8382 100644 --- a/lib/ui/vendor/vendor_screen.dart +++ b/lib/ui/vendor/vendor_screen.dart @@ -36,6 +36,8 @@ class VendorScreen extends StatelessWidget { isChecked: isInMultiselect && listUIState.selectedIds.length == viewModel.vendorList.length, showCheckbox: isInMultiselect, + onHamburgerLongPress: () => + store.dispatch(StartVendorMultiselect(context: context)), onCheckboxChanged: (value) { final vendors = viewModel.vendorList .map((vendorId) => viewModel.vendorMap[vendorId])