diff --git a/lib/data/models/client_model.dart b/lib/data/models/client_model.dart index 44b4c868c..de42cc7dc 100644 --- a/lib/data/models/client_model.dart +++ b/lib/data/models/client_model.dart @@ -325,7 +325,9 @@ abstract class ClientEntity extends Object return true; } else if (city.toLowerCase().contains(filter)) { return true; - } else if (contacts.where((contact) => contact.matchesFilter(filter)).isNotEmpty) { + } else if (contacts + .where((contact) => contact.matchesFilter(filter)) + .isNotEmpty) { return true; } @@ -340,7 +342,7 @@ abstract class ClientEntity extends Object filter = filter.toLowerCase(); final contact = contacts.firstWhere( - (contact) => contact.matchesFilter(filter), + (contact) => contact.matchesFilter(filter), orElse: () => null); if (vatNumber.toLowerCase().contains(filter)) { diff --git a/lib/data/models/vendor_model.dart b/lib/data/models/vendor_model.dart index eaafd8db1..016fe7f60 100644 --- a/lib/data/models/vendor_model.dart +++ b/lib/data/models/vendor_model.dart @@ -215,7 +215,9 @@ abstract class VendorEntity extends Object return true; } else if (city.toLowerCase().contains(filter)) { return true; - } else if (contacts.where((contact) => contact.matchesFilter(filter)).isNotEmpty) { + } else if (contacts + .where((contact) => contact.matchesFilter(filter)) + .isNotEmpty) { return true; } @@ -230,7 +232,7 @@ abstract class VendorEntity extends Object filter = filter.toLowerCase(); final contact = contacts.firstWhere( - (contact) => contact.matchesFilter(filter), + (contact) => contact.matchesFilter(filter), orElse: () => null); if (vatNumber.toLowerCase().contains(filter)) { diff --git a/lib/redux/company/company_selectors.dart b/lib/redux/company/company_selectors.dart index 9c2408896..bbe85a33e 100644 --- a/lib/redux/company/company_selectors.dart +++ b/lib/redux/company/company_selectors.dart @@ -130,7 +130,8 @@ List companiesSelector(AppState state) { } String localeSelector(AppState state) { - final locale = state.staticState?.languageMap[state.selectedCompany?.languageId]?.locale ?? + final locale = state.staticState + ?.languageMap[state.selectedCompany?.languageId]?.locale ?? 'en'; // https://github.com/flutter/flutter/issues/32090 @@ -139,4 +140,4 @@ String localeSelector(AppState state) { } else { return locale; } -} \ No newline at end of file +} diff --git a/lib/redux/document/document_middleware.dart b/lib/redux/document/document_middleware.dart index c321978a4..f8e14257c 100644 --- a/lib/redux/document/document_middleware.dart +++ b/lib/redux/document/document_middleware.dart @@ -38,7 +38,8 @@ List> createStoreDocumentsMiddleware([ } Middleware _editDocument() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as EditDocument; next(action); @@ -54,7 +55,8 @@ Middleware _editDocument() { } Middleware _viewDocument() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as ViewDocument; next(action); diff --git a/lib/redux/document/document_reducer.dart b/lib/redux/document/document_reducer.dart index ef4a38ef5..97125b53b 100644 --- a/lib/redux/document/document_reducer.dart +++ b/lib/redux/document/document_reducer.dart @@ -14,8 +14,7 @@ EntityUIState documentUIReducer(DocumentUIState state, dynamic action) { } Reducer selectedIdReducer = combineReducers([ - TypedReducer( - (selectedId, action) => action.documentId), + TypedReducer((selectedId, action) => action.documentId), TypedReducer( (selectedId, action) => action.document.id), ]); diff --git a/lib/redux/expense/expense_actions.dart b/lib/redux/expense/expense_actions.dart index ea60c1e72..75d24ada9 100644 --- a/lib/redux/expense/expense_actions.dart +++ b/lib/redux/expense/expense_actions.dart @@ -33,10 +33,10 @@ class ViewExpense implements PersistUI { class EditExpense implements PersistUI { EditExpense( {@required this.expense, - @required this.context, - this.completer, - this.force = false, - this.trackRoute = true}); + @required this.context, + this.completer, + this.force = false, + this.trackRoute = true}); final ExpenseEntity expense; final BuildContext context; diff --git a/lib/redux/expense/expense_middleware.dart b/lib/redux/expense/expense_middleware.dart index dac6aa363..897700091 100644 --- a/lib/redux/expense/expense_middleware.dart +++ b/lib/redux/expense/expense_middleware.dart @@ -41,7 +41,8 @@ List> createStoreExpensesMiddleware([ } Middleware _editExpense() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as EditExpense; if (hasChanges( @@ -55,19 +56,18 @@ Middleware _editExpense() { if (isMobile(action.context)) { final expense = - await Navigator.of(action.context).pushNamed(ExpenseEditScreen.route); + await Navigator.of(action.context).pushNamed(ExpenseEditScreen.route); if (action.completer != null && expense != null) { action.completer.complete(expense); } - } - }; } Middleware _viewExpense() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as ViewExpense; next(action); diff --git a/lib/redux/expense/expense_reducer.dart b/lib/redux/expense/expense_reducer.dart index 2cf341042..b4449051a 100644 --- a/lib/redux/expense/expense_reducer.dart +++ b/lib/redux/expense/expense_reducer.dart @@ -14,8 +14,7 @@ EntityUIState expenseUIReducer(ExpenseUIState state, dynamic action) { } Reducer selectedIdReducer = combineReducers([ - TypedReducer( - (selectedId, action) => action.expenseId), + TypedReducer((selectedId, action) => action.expenseId), TypedReducer( (selectedId, action) => action.expense.id), ]); diff --git a/lib/redux/invoice/invoice_middleware.dart b/lib/redux/invoice/invoice_middleware.dart index 61426c4d1..7af3af65b 100644 --- a/lib/redux/invoice/invoice_middleware.dart +++ b/lib/redux/invoice/invoice_middleware.dart @@ -70,7 +70,8 @@ Middleware _viewInvoiceList() { } Middleware _viewInvoice() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as ViewInvoice; if (hasChanges( @@ -89,7 +90,8 @@ Middleware _viewInvoice() { } Middleware _editInvoice() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as EditInvoice; if (hasChanges( @@ -113,7 +115,8 @@ Middleware _editInvoice() { } Middleware _showEmailInvoice() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as ShowEmailInvoice; next(action); diff --git a/lib/redux/invoice/invoice_reducer.dart b/lib/redux/invoice/invoice_reducer.dart index 7e1e1bd53..cad87a571 100644 --- a/lib/redux/invoice/invoice_reducer.dart +++ b/lib/redux/invoice/invoice_reducer.dart @@ -35,8 +35,7 @@ String filterClientDropdownReducer( } Reducer selectedIdReducer = combineReducers([ - TypedReducer( - (selectedId, action) => action.invoiceId), + TypedReducer((selectedId, action) => action.invoiceId), TypedReducer( (selectedId, action) => action.invoice.id), TypedReducer( diff --git a/lib/redux/payment/payment_actions.dart b/lib/redux/payment/payment_actions.dart index c7d2145b4..0b0fa12c5 100644 --- a/lib/redux/payment/payment_actions.dart +++ b/lib/redux/payment/payment_actions.dart @@ -30,10 +30,10 @@ class ViewPayment implements PersistUI { class EditPayment implements PersistUI { EditPayment( {@required this.payment, - @required this.context, - this.completer, - this.force = false, - this.trackRoute = true}); + @required this.context, + this.completer, + this.force = false, + this.trackRoute = true}); final PaymentEntity payment; final BuildContext context; diff --git a/lib/redux/payment/payment_middleware.dart b/lib/redux/payment/payment_middleware.dart index ca9af551f..0c25ff71f 100644 --- a/lib/redux/payment/payment_middleware.dart +++ b/lib/redux/payment/payment_middleware.dart @@ -59,8 +59,7 @@ Middleware _editPayment() { } Middleware _viewPayment() { - return (Store store, dynamic action, - NextDispatcher next) async { + return (Store store, dynamic action, NextDispatcher next) async { next(action); store.dispatch(UpdateCurrentRoute(PaymentViewScreen.route)); diff --git a/lib/redux/payment/payment_reducer.dart b/lib/redux/payment/payment_reducer.dart index 331a86934..b25470b60 100644 --- a/lib/redux/payment/payment_reducer.dart +++ b/lib/redux/payment/payment_reducer.dart @@ -14,8 +14,7 @@ EntityUIState paymentUIReducer(PaymentUIState state, dynamic action) { } Reducer selectedIdReducer = combineReducers([ - TypedReducer( - (selectedId, action) => action.paymentId), + TypedReducer((selectedId, action) => action.paymentId), TypedReducer( (selectedId, action) => action.payment.id), ]); diff --git a/lib/redux/product/product_actions.dart b/lib/redux/product/product_actions.dart index 8359f8dff..2811c7790 100644 --- a/lib/redux/product/product_actions.dart +++ b/lib/redux/product/product_actions.dart @@ -27,7 +27,11 @@ class ViewProduct implements PersistUI { } class EditProduct implements PersistUI { - EditProduct({@required this.product, @required this.context, this.completer, this.force = false}); + EditProduct( + {@required this.product, + @required this.context, + this.completer, + this.force = false}); final ProductEntity product; final BuildContext context; diff --git a/lib/redux/product/product_middleware.dart b/lib/redux/product/product_middleware.dart index 2d8dff2b5..061a51749 100644 --- a/lib/redux/product/product_middleware.dart +++ b/lib/redux/product/product_middleware.dart @@ -37,7 +37,8 @@ List> createStoreProductsMiddleware([ } Middleware _editProduct() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as EditProduct; if (hasChanges( @@ -56,7 +57,8 @@ Middleware _editProduct() { } Middleware _viewProduct() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as ViewProduct; if (hasChanges( diff --git a/lib/redux/product/product_reducer.dart b/lib/redux/product/product_reducer.dart index 62de5f804..243d96342 100644 --- a/lib/redux/product/product_reducer.dart +++ b/lib/redux/product/product_reducer.dart @@ -42,8 +42,7 @@ ProductEntity _updateEditing(ProductEntity client, dynamic action) { } Reducer selectedIdReducer = combineReducers([ - TypedReducer( - (selectedId, action) => action.productId), + TypedReducer((selectedId, action) => action.productId), TypedReducer( (selectedId, action) => action.product.id), ]); diff --git a/lib/redux/project/project_actions.dart b/lib/redux/project/project_actions.dart index 6fa845b74..fd82d50bd 100644 --- a/lib/redux/project/project_actions.dart +++ b/lib/redux/project/project_actions.dart @@ -34,10 +34,10 @@ class ViewProject implements PersistUI { class EditProject implements PersistUI { EditProject( {@required this.project, - @required this.context, - this.completer, - this.force = false, - this.trackRoute = true}); + @required this.context, + this.completer, + this.force = false, + this.trackRoute = true}); final ProjectEntity project; final BuildContext context; diff --git a/lib/redux/project/project_middleware.dart b/lib/redux/project/project_middleware.dart index b87d9da07..77d0555c8 100644 --- a/lib/redux/project/project_middleware.dart +++ b/lib/redux/project/project_middleware.dart @@ -41,7 +41,8 @@ List> createStoreProjectsMiddleware([ } Middleware _editProject() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as EditProject; if (hasChanges( @@ -55,18 +56,18 @@ Middleware _editProject() { if (isMobile(action.context)) { final project = - await Navigator.of(action.context).pushNamed(ProjectEditScreen.route); + await Navigator.of(action.context).pushNamed(ProjectEditScreen.route); if (action.completer != null && project != null) { action.completer.complete(project); } } - }; } Middleware _viewProject() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as ViewProject; next(action); diff --git a/lib/redux/project/project_reducer.dart b/lib/redux/project/project_reducer.dart index 65aeefd6f..0d5265df0 100644 --- a/lib/redux/project/project_reducer.dart +++ b/lib/redux/project/project_reducer.dart @@ -14,8 +14,7 @@ EntityUIState projectUIReducer(ProjectUIState state, dynamic action) { } Reducer selectedIdReducer = combineReducers([ - TypedReducer( - (selectedId, action) => action.projectId), + TypedReducer((selectedId, action) => action.projectId), TypedReducer( (selectedId, action) => action.project.id), ]); diff --git a/lib/redux/quote/quote_actions.dart b/lib/redux/quote/quote_actions.dart index 45e2c7a0a..48e27c9a0 100644 --- a/lib/redux/quote/quote_actions.dart +++ b/lib/redux/quote/quote_actions.dart @@ -28,7 +28,12 @@ class ViewQuote implements PersistUI { } class EditQuote implements PersistUI { - EditQuote({this.quote, this.context, this.completer, this.quoteItem, this.force = false}); + EditQuote( + {this.quote, + this.context, + this.completer, + this.quoteItem, + this.force = false}); final InvoiceEntity quote; final InvoiceItemEntity quoteItem; diff --git a/lib/redux/quote/quote_middleware.dart b/lib/redux/quote/quote_middleware.dart index 65bd02dd3..f0b91e57b 100644 --- a/lib/redux/quote/quote_middleware.dart +++ b/lib/redux/quote/quote_middleware.dart @@ -48,7 +48,8 @@ List> createStoreQuotesMiddleware([ } Middleware _viewQuote() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as ViewQuote; if (hasChanges( @@ -74,14 +75,13 @@ Middleware _viewQuoteList() { if (isMobile(action.context)) { Navigator.of(action.context).pushNamedAndRemoveUntil( QuoteScreen.route, (Route route) => false); - } - }; } Middleware _editQuote() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as EditQuote; next(action); @@ -97,7 +97,8 @@ Middleware _editQuote() { } Middleware _showEmailQuote() { - return (Store store, dynamic dynamicAction, NextDispatcher next) async { + return (Store store, dynamic dynamicAction, + NextDispatcher next) async { final action = dynamicAction as ShowEmailQuote; next(action); diff --git a/lib/redux/quote/quote_reducer.dart b/lib/redux/quote/quote_reducer.dart index e74894437..e8ad7a291 100644 --- a/lib/redux/quote/quote_reducer.dart +++ b/lib/redux/quote/quote_reducer.dart @@ -34,12 +34,9 @@ String filterClientDropdownReducer( } Reducer selectedIdReducer = combineReducers([ - TypedReducer( - (selectedId, action) => action.quoteId), - TypedReducer( - (selectedId, action) => action.quote.id), - TypedReducer( - (selectedId, action) => action.quote.id), + TypedReducer((selectedId, action) => action.quoteId), + TypedReducer((selectedId, action) => action.quote.id), + TypedReducer((selectedId, action) => action.quote.id), ]); final editingReducer = combineReducers([ diff --git a/lib/redux/task/task_reducer.dart b/lib/redux/task/task_reducer.dart index f0b0e7df7..a7d24d7c9 100644 --- a/lib/redux/task/task_reducer.dart +++ b/lib/redux/task/task_reducer.dart @@ -24,10 +24,8 @@ TaskTime editTaskTime(TaskTime taskTime, dynamic action) { } Reducer selectedIdReducer = combineReducers([ - TypedReducer( - (selectedId, action) => action.taskId), - TypedReducer( - (selectedId, action) => action.task.id), + TypedReducer((selectedId, action) => action.taskId), + TypedReducer((selectedId, action) => action.task.id), ]); final editingReducer = combineReducers([ diff --git a/lib/redux/ui/ui_state.dart b/lib/redux/ui/ui_state.dart index 751e9e05a..6b85d6954 100644 --- a/lib/redux/ui/ui_state.dart +++ b/lib/redux/ui/ui_state.dart @@ -117,13 +117,13 @@ abstract class UIState implements Built { String get mainRoute { final parts = - currentRoute.split('/').where((part) => part.isNotEmpty).toList(); + currentRoute.split('/').where((part) => part.isNotEmpty).toList(); return parts.isNotEmpty ? parts[0] : ''; } String get subRoute { final parts = - currentRoute.split('/').where((part) => part.isNotEmpty).toList(); + currentRoute.split('/').where((part) => part.isNotEmpty).toList(); return parts.length > 1 ? parts[1] : ''; } diff --git a/lib/redux/vendor/vendor_actions.dart b/lib/redux/vendor/vendor_actions.dart index 3dbf25313..20598d955 100644 --- a/lib/redux/vendor/vendor_actions.dart +++ b/lib/redux/vendor/vendor_actions.dart @@ -31,11 +31,11 @@ class ViewVendor implements PersistUI { class EditVendor implements PersistUI { EditVendor( {@required this.vendor, - @required this.context, - this.contact, - this.completer, - this.force = false, - this.trackRoute = true}); + @required this.context, + this.contact, + this.completer, + this.force = false, + this.trackRoute = true}); final VendorEntity vendor; final VendorContactEntity contact; diff --git a/lib/redux/vendor/vendor_reducer.dart b/lib/redux/vendor/vendor_reducer.dart index d7843e2d6..5bf42bed0 100644 --- a/lib/redux/vendor/vendor_reducer.dart +++ b/lib/redux/vendor/vendor_reducer.dart @@ -26,10 +26,8 @@ VendorContactEntity editVendorContact( } Reducer selectedIdReducer = combineReducers([ - TypedReducer( - (selectedId, action) => action.vendorId), - TypedReducer( - (selectedId, action) => action.vendor.id), + TypedReducer((selectedId, action) => action.vendorId), + TypedReducer((selectedId, action) => action.vendor.id), ]); final editingReducer = combineReducers([ diff --git a/lib/ui/app/app_drawer.dart b/lib/ui/app/app_drawer.dart index 33c368f40..4bfcef496 100644 --- a/lib/ui/app/app_drawer.dart +++ b/lib/ui/app/app_drawer.dart @@ -236,7 +236,8 @@ class AppDrawer extends StatelessWidget { entityType: EntityType.payment, icon: getEntityIcon(EntityType.payment), title: localization.payments, - onTap: () => store.dispatch(ViewPaymentList(context: context)), + onTap: () => + store.dispatch(ViewPaymentList(context: context)), onCreateTap: () { if (isMobile(context)) { navigator.pop(); @@ -251,7 +252,8 @@ class AppDrawer extends StatelessWidget { entityType: EntityType.quote, icon: getEntityIcon(EntityType.quote), title: localization.quotes, - onTap: () => store.dispatch(ViewQuoteList(context: context)), + onTap: () => + store.dispatch(ViewQuoteList(context: context)), onCreateTap: () { if (isMobile(context)) { navigator.pop(); @@ -266,7 +268,8 @@ class AppDrawer extends StatelessWidget { entityType: EntityType.project, icon: getEntityIcon(EntityType.project), title: localization.projects, - onTap: () => store.dispatch(ViewProjectList(context: context)), + onTap: () => + store.dispatch(ViewProjectList(context: context)), onCreateTap: () { if (isMobile(context)) { navigator.pop(); @@ -280,7 +283,8 @@ class AppDrawer extends StatelessWidget { entityType: EntityType.task, icon: getEntityIcon(EntityType.task), title: localization.tasks, - onTap: () => store.dispatch(ViewTaskList(context: context)), + onTap: () => + store.dispatch(ViewTaskList(context: context)), onCreateTap: () { if (isMobile(context)) { navigator.pop(); @@ -296,7 +300,8 @@ class AppDrawer extends StatelessWidget { entityType: EntityType.vendor, icon: getEntityIcon(EntityType.vendor), title: localization.vendors, - onTap: () => store.dispatch(ViewVendorList(context: context)), + onTap: () => + store.dispatch(ViewVendorList(context: context)), onCreateTap: () { if (isMobile(context)) { navigator.pop(); @@ -310,7 +315,8 @@ class AppDrawer extends StatelessWidget { entityType: EntityType.expense, icon: getEntityIcon(EntityType.expense), title: localization.expenses, - onTap: () => store.dispatch(ViewExpenseList(context: context)), + onTap: () => + store.dispatch(ViewExpenseList(context: context)), onCreateTap: () { if (isMobile(context)) { navigator.pop(); diff --git a/lib/ui/document/edit/document_edit.dart b/lib/ui/document/edit/document_edit.dart index 42ca03bed..60c6d3c61 100644 --- a/lib/ui/document/edit/document_edit.dart +++ b/lib/ui/document/edit/document_edit.dart @@ -78,6 +78,16 @@ class _DocumentEditState extends State { ? localization.newDocument : localization.editDocument), actions: [ + /* + if (!isMobile(context)) + FlatButton( + child: Text( + localization.cancel, + style: TextStyle(color: Colors.white), + ), + onPressed: () => viewModel.onCancelPressed(context), + ), + */ ActionIconButton( icon: Icons.cloud_upload, tooltip: localization.save, diff --git a/lib/ui/expense/edit/expense_edit.dart b/lib/ui/expense/edit/expense_edit.dart index ffb6c3cce..492601adc 100644 --- a/lib/ui/expense/edit/expense_edit.dart +++ b/lib/ui/expense/edit/expense_edit.dart @@ -55,6 +55,14 @@ class _ExpenseEditState extends State ? localization.newExpense : localization.editExpense), actions: [ + if (!isMobile(context)) + FlatButton( + child: Text( + localization.cancel, + style: TextStyle(color: Colors.white), + ), + onPressed: () => viewModel.onCancelPressed(context), + ), ActionIconButton( icon: Icons.cloud_upload, tooltip: localization.save, diff --git a/lib/ui/invoice/edit/invoice_edit_details.dart b/lib/ui/invoice/edit/invoice_edit_details.dart index b778d2a8e..18f9d33ad 100644 --- a/lib/ui/invoice/edit/invoice_edit_details.dart +++ b/lib/ui/invoice/edit/invoice_edit_details.dart @@ -158,7 +158,8 @@ class InvoiceEditDetailsState extends State { viewModel.onAddClientPressed(context, completer); completer.future.then((client) { final store = StoreProvider.of(context); - store.dispatch(UpdateCurrentRoute(InvoiceEditScreen.route)); + store.dispatch( + UpdateCurrentRoute(InvoiceEditScreen.route)); }); }, ) diff --git a/lib/ui/invoice/invoice_list_item.dart b/lib/ui/invoice/invoice_list_item.dart index acffd657c..a562e4622 100644 --- a/lib/ui/invoice/invoice_list_item.dart +++ b/lib/ui/invoice/invoice_list_item.dart @@ -74,13 +74,14 @@ class InvoiceListItem extends StatelessWidget { Expanded( child: filterMatch == null ? Text((invoice.invoiceNumber + - ' • ' + - formatDate( - invoice.dueDate.isNotEmpty - ? invoice.dueDate - : invoice.invoiceDate, - context) + - (hasDocuments ? ' 📎' : '')).trim()) + ' • ' + + formatDate( + invoice.dueDate.isNotEmpty + ? invoice.dueDate + : invoice.invoiceDate, + context) + + (hasDocuments ? ' 📎' : '')) + .trim()) : Text( filterMatch, maxLines: 3, diff --git a/lib/ui/payment/edit/payment_edit.dart b/lib/ui/payment/edit/payment_edit.dart index d168b876a..01335a032 100644 --- a/lib/ui/payment/edit/payment_edit.dart +++ b/lib/ui/payment/edit/payment_edit.dart @@ -97,6 +97,14 @@ class _PaymentEditState extends State { ? localization.enterPayment : localization.editPayment), actions: [ + if (!isMobile(context)) + FlatButton( + child: Text( + localization.cancel, + style: TextStyle(color: Colors.white), + ), + onPressed: () => viewModel.onCancelPressed(context), + ), Builder(builder: (BuildContext context) { return ActionIconButton( icon: Icons.cloud_upload, diff --git a/lib/ui/payment/view/payment_view.dart b/lib/ui/payment/view/payment_view.dart index e4a395539..56baff23c 100644 --- a/lib/ui/payment/view/payment_view.dart +++ b/lib/ui/payment/view/payment_view.dart @@ -47,7 +47,8 @@ class _PaymentViewState extends State { formatDate(payment.paymentDate, context); } if (payment.paymentTypeId > 0) { - final paymentType = state.staticState.paymentTypeMap[payment.paymentTypeId]; + final paymentType = + state.staticState.paymentTypeMap[payment.paymentTypeId]; if (paymentType != null) { fields[PaymentFields.paymentTypeId] = paymentType.name; } diff --git a/lib/ui/product/edit/product_edit.dart b/lib/ui/product/edit/product_edit.dart index 83be00685..e862b6cf9 100644 --- a/lib/ui/product/edit/product_edit.dart +++ b/lib/ui/product/edit/product_edit.dart @@ -106,6 +106,14 @@ class _ProductEditState extends State { ? localization.newProduct : localization.editProduct), actions: [ + if (!isMobile(context)) + FlatButton( + child: Text( + localization.cancel, + style: TextStyle(color: Colors.white), + ), + onPressed: () => viewModel.onCancelPressed(context), + ), Builder(builder: (BuildContext context) { if (!user.canEditEntity(product)) { return Container(); diff --git a/lib/ui/project/edit/project_edit.dart b/lib/ui/project/edit/project_edit.dart index 0c1349686..694b3952a 100644 --- a/lib/ui/project/edit/project_edit.dart +++ b/lib/ui/project/edit/project_edit.dart @@ -113,6 +113,14 @@ class _ProjectEditState extends State { ? localization.newProject : localization.editProject), actions: [ + if (!isMobile(context)) + FlatButton( + child: Text( + localization.cancel, + style: TextStyle(color: Colors.white), + ), + onPressed: () => viewModel.onCancelPressed(context), + ), Builder(builder: (BuildContext context) { return ActionIconButton( icon: Icons.cloud_upload, diff --git a/lib/ui/quote/quote_screen.dart b/lib/ui/quote/quote_screen.dart index 5fec9775f..345f0affe 100644 --- a/lib/ui/quote/quote_screen.dart +++ b/lib/ui/quote/quote_screen.dart @@ -62,27 +62,27 @@ class QuoteScreen extends StatelessWidget { }, statuses: [ InvoiceStatusEntity().rebuild( - (b) => b + (b) => b ..id = 1 ..name = localization.draft, ), InvoiceStatusEntity().rebuild( - (b) => b + (b) => b ..id = 2 ..name = localization.sent, ), InvoiceStatusEntity().rebuild( - (b) => b + (b) => b ..id = 3 ..name = localization.viewed, ), InvoiceStatusEntity().rebuild( - (b) => b + (b) => b ..id = 4 ..name = localization.approved, ), InvoiceStatusEntity().rebuild( - (b) => b + (b) => b ..id = -1 ..name = localization.expired, ), @@ -90,21 +90,21 @@ class QuoteScreen extends StatelessWidget { ), floatingActionButton: user.canCreate(EntityType.quote) ? FloatingActionButton( - backgroundColor: Theme.of(context).primaryColorDark, - onPressed: () { - store.dispatch(EditQuote( - quote: InvoiceEntity(company: company, isQuote: true) - .rebuild((b) => b - ..clientId = - store.state.quoteListState.filterEntityId ?? 0), - context: context)); - }, - child: Icon( - Icons.add, - color: Colors.white, - ), - tooltip: localization.newQuote, - ) + backgroundColor: Theme.of(context).primaryColorDark, + onPressed: () { + store.dispatch(EditQuote( + quote: InvoiceEntity(company: company, isQuote: true) + .rebuild((b) => b + ..clientId = + store.state.quoteListState.filterEntityId ?? 0), + context: context)); + }, + child: Icon( + Icons.add, + color: Colors.white, + ), + tooltip: localization.newQuote, + ) : null, ); } diff --git a/lib/ui/task/edit/task_edit.dart b/lib/ui/task/edit/task_edit.dart index a4dcff3c3..77d9b61c6 100644 --- a/lib/ui/task/edit/task_edit.dart +++ b/lib/ui/task/edit/task_edit.dart @@ -72,6 +72,14 @@ class _TaskEditState extends State title: Text(task.isNew ? localization.newTask : localization.editTask), actions: [ + if (!isMobile(context)) + FlatButton( + child: Text( + localization.cancel, + style: TextStyle(color: Colors.white), + ), + onPressed: () => viewModel.onCancelPressed(context), + ), ActionIconButton( icon: Icons.cloud_upload, tooltip: localization.save, diff --git a/lib/ui/task/edit/task_edit_vm.dart b/lib/ui/task/edit/task_edit_vm.dart index a74b82141..91b02798e 100644 --- a/lib/ui/task/edit/task_edit_vm.dart +++ b/lib/ui/task/edit/task_edit_vm.dart @@ -66,8 +66,8 @@ class TaskEditVM { } }, onCancelPressed: (BuildContext context) { - store.dispatch(EditTask( - task: TaskEntity(), context: context, force: true)); + store.dispatch( + EditTask(task: TaskEntity(), context: context, force: true)); store.dispatch(UpdateCurrentRoute(state.uiState.previousRoute)); }, onFabPressed: () { diff --git a/lib/ui/vendor/edit/vendor_edit.dart b/lib/ui/vendor/edit/vendor_edit.dart index b795f44c5..1695717e0 100644 --- a/lib/ui/vendor/edit/vendor_edit.dart +++ b/lib/ui/vendor/edit/vendor_edit.dart @@ -55,6 +55,14 @@ class _VendorEditState extends State title: Text( vendor.isNew ? localization.newVendor : localization.editVendor), actions: [ + if (!isMobile(context)) + FlatButton( + child: Text( + localization.cancel, + style: TextStyle(color: Colors.white), + ), + onPressed: () => viewModel.onCancelPressed(context), + ), ActionIconButton( icon: Icons.cloud_upload, tooltip: localization.save, diff --git a/lib/ui/vendor/edit/vendor_edit_vm.dart b/lib/ui/vendor/edit/vendor_edit_vm.dart index 352d0f5a0..c3ec7a0d4 100644 --- a/lib/ui/vendor/edit/vendor_edit_vm.dart +++ b/lib/ui/vendor/edit/vendor_edit_vm.dart @@ -68,8 +68,8 @@ class VendorEditVM { } }, onCancelPressed: (BuildContext context) { - store.dispatch(EditVendor( - vendor: VendorEntity(), context: context, force: true)); + store.dispatch( + EditVendor(vendor: VendorEntity(), context: context, force: true)); store.dispatch(UpdateCurrentRoute(state.uiState.previousRoute)); }, onSavePressed: (BuildContext context) { diff --git a/stubs/ui/stub/edit/stub_edit b/stubs/ui/stub/edit/stub_edit index c22d875d6..4074a7386 100644 --- a/stubs/ui/stub/edit/stub_edit +++ b/stubs/ui/stub/edit/stub_edit @@ -78,6 +78,14 @@ class _StubEditState extends State { ? localization.newStub : localization.editStub), actions: [ + if (!isMobile(context)) + FlatButton( + child: Text( + localization.cancel, + style: TextStyle(color: Colors.white), + ), + onPressed: () => viewModel.onCancelPressed(context), + ), ActionIconButton( icon: Icons.cloud_upload, tooltip: localization.save,