diff --git a/lib/ui/client/view/client_view_details.dart b/lib/ui/client/view/client_view_details.dart index 44ee0d86b..4b03e8574 100644 --- a/lib/ui/client/view/client_view_details.dart +++ b/lib/ui/client/view/client_view_details.dart @@ -93,7 +93,7 @@ class _ClientViewDetailsState extends State { subtitle: subtitleParts.join('\n'), copyValue: contact.email, onLongPress: () => setState(() { - if ((contact.email ?? '').isEmpty) { + if (contact.email.isEmpty) { return; } diff --git a/lib/ui/dashboard/dashboard_sidebar.dart b/lib/ui/dashboard/dashboard_sidebar.dart index 719c90fe5..7b00e580b 100644 --- a/lib/ui/dashboard/dashboard_sidebar.dart +++ b/lib/ui/dashboard/dashboard_sidebar.dart @@ -243,7 +243,7 @@ class QuoteSidebar extends StatelessWidget { itemCount: upcomingQuotes.length, itemBuilder: (BuildContext context, int index) { return QuoteListItem( - quote: upcomingQuotes[index], + quote: upcomingQuotes[index]!, showCheckbox: false, ); }, @@ -257,7 +257,7 @@ class QuoteSidebar extends StatelessWidget { itemCount: expriedQuotes.length, itemBuilder: (BuildContext context, int index) { return QuoteListItem( - quote: expriedQuotes[index], + quote: expriedQuotes[index]!, showCheckbox: false, ); }, diff --git a/lib/ui/purchase_order/purchase_order_list_item.dart b/lib/ui/purchase_order/purchase_order_list_item.dart index 61a8fdc1e..97fb78182 100644 --- a/lib/ui/purchase_order/purchase_order_list_item.dart +++ b/lib/ui/purchase_order/purchase_order_list_item.dart @@ -217,7 +217,7 @@ class PurchaseOrderListItem extends StatelessWidget { children: [ Expanded( child: filterMatch == null - ? Text((((purchaseOrder.number ?? '').isEmpty + ? Text((((purchaseOrder.number).isEmpty ? localization!.pending : purchaseOrder.number) + ' • ' + diff --git a/lib/ui/purchase_order/purchase_order_presenter.dart b/lib/ui/purchase_order/purchase_order_presenter.dart index 208f81530..d3355e5c2 100644 --- a/lib/ui/purchase_order/purchase_order_presenter.dart +++ b/lib/ui/purchase_order/purchase_order_presenter.dart @@ -73,7 +73,7 @@ class PurchaseOrderPresenter extends EntityPresenter { case PurchaseOrderFields.status: return EntityStatusChip(entity: purchaseOrder, showState: true); case PurchaseOrderFields.number: - return Text((purchaseOrder.number ?? '').isEmpty + return Text((purchaseOrder.number).isEmpty ? localization!.pending : purchaseOrder.number); case PurchaseOrderFields.client: diff --git a/lib/ui/quote/quote_list_item.dart b/lib/ui/quote/quote_list_item.dart index 15ae24362..90702d59f 100644 --- a/lib/ui/quote/quote_list_item.dart +++ b/lib/ui/quote/quote_list_item.dart @@ -24,40 +24,40 @@ class QuoteListItem extends StatelessWidget { this.showCheckbox = true, }); - final InvoiceEntity? quote; + final InvoiceEntity quote; final String? filter; final bool showCheckbox; @override Widget build(BuildContext context) { final state = StoreProvider.of(context).state; - final client = state.clientState.get(quote!.clientId); + final client = state.clientState.get(quote.clientId); final uiState = state.uiState; final quoteUIState = uiState.quoteUIState; - final listUIState = state.getUIState(quote!.entityType)!.listUIState; + final listUIState = state.getUIState(quote.entityType)!.listUIState; final isInMultiselect = showCheckbox && listUIState.isInMultiselect(); - final isChecked = isInMultiselect && listUIState.isSelected(quote!.id); + final isChecked = isInMultiselect && listUIState.isSelected(quote.id); final textStyle = TextStyle(fontSize: 16); final localization = AppLocalization.of(context); final textColor = Theme.of(context).textTheme.bodyLarge!.color; final filterMatch = filter != null && filter!.isNotEmpty - ? (quote!.matchesFilterValue(filter) ?? + ? (quote.matchesFilterValue(filter) ?? client.matchesFilterValue(filter)) : null; String subtitle = ''; - if (quote!.date.isNotEmpty) { - subtitle = formatDate(quote!.date, context); + if (quote.date.isNotEmpty) { + subtitle = formatDate(quote.date, context); } - if (quote!.dueDate.isNotEmpty) { + if (quote.dueDate.isNotEmpty) { if (subtitle.isNotEmpty) { subtitle += ' • '; } - subtitle += formatDate(quote!.dueDate, context); + subtitle += formatDate(quote.dueDate, context); } return DismissibleEntity( - isSelected: quote!.id == + isSelected: quote.id == (uiState.isEditing ? quoteUIState.editing!.id : quoteUIState.selectedId), @@ -69,9 +69,9 @@ class QuoteListItem extends StatelessWidget { return constraints.maxWidth > kTableListWidthCutoff ? InkWell( onTap: () => - selectEntity(entity: quote!, forceView: !showCheckbox), + selectEntity(entity: quote, forceView: !showCheckbox), onLongPress: () => - selectEntity(entity: quote!, longPress: true), + selectEntity(entity: quote, longPress: true), child: Padding( padding: const EdgeInsets.only( left: 10, @@ -97,7 +97,7 @@ class QuoteListItem extends StatelessWidget { ), ) : ActionMenuButton( - entityActions: quote!.getActions( + entityActions: quote.getActions( userCompany: state.userCompany, client: client, includeEdit: true, @@ -113,13 +113,13 @@ class QuoteListItem extends StatelessWidget { crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( - (quote!.number ?? '').isEmpty + (quote.number).isEmpty ? localization!.pending - : quote!.number, + : quote.number, style: textStyle, overflow: TextOverflow.ellipsis, ), - if (!quote!.isActive) EntityStateLabel(quote) + if (!quote.isActive) EntityStateLabel(quote) ], ), ), @@ -130,7 +130,7 @@ class QuoteListItem extends StatelessWidget { children: [ Text( client.displayName + - (quote!.documents.isNotEmpty + (quote.documents.isNotEmpty ? ' 📎' : ''), style: textStyle), @@ -151,7 +151,7 @@ class QuoteListItem extends StatelessWidget { ), SizedBox(width: 10), Text( - formatNumber(quote!.amount, context, + formatNumber(quote.amount, context, clientId: client.id)!, style: textStyle, textAlign: TextAlign.end, @@ -164,9 +164,9 @@ class QuoteListItem extends StatelessWidget { ) : ListTile( onTap: () => - selectEntity(entity: quote!, forceView: !showCheckbox), + selectEntity(entity: quote, forceView: !showCheckbox), onLongPress: () => - selectEntity(entity: quote!, longPress: true), + selectEntity(entity: quote, longPress: true), leading: isInMultiselect ? IgnorePointer( ignoring: listUIState.isInMultiselect(), @@ -193,8 +193,8 @@ class QuoteListItem extends StatelessWidget { ), SizedBox(width: 4), Text( - formatNumber(quote!.amount, context, - clientId: quote!.clientId)!, + formatNumber(quote.amount, context, + clientId: quote.clientId)!, style: Theme.of(context).textTheme.titleMedium), ], ), @@ -206,16 +206,16 @@ class QuoteListItem extends StatelessWidget { children: [ Expanded( child: filterMatch == null - ? Text((((quote!.number ?? '').isEmpty + ? Text((((quote.number ?? '').isEmpty ? localization!.pending - : quote!.number) + + : quote.number) + ' • ' + formatDate( - quote!.dueDate.isNotEmpty - ? quote!.dueDate - : quote!.date, + quote.dueDate.isNotEmpty + ? quote.dueDate + : quote.date, context) + - (quote!.documents.isNotEmpty + (quote.documents.isNotEmpty ? ' 📎' : '')) .trim()) @@ -227,13 +227,13 @@ class QuoteListItem extends StatelessWidget { ), Text( localization!.lookup( - kQuoteStatuses[quote!.calculatedStatusId])!, + kQuoteStatuses[quote.calculatedStatusId])!, style: TextStyle( - color: !quote!.isSent + color: !quote.isSent ? textColor : QuoteStatusColors( state.prefState.colorThemeModel) - .colors[quote!.calculatedStatusId], + .colors[quote.calculatedStatusId], )), ], ), diff --git a/lib/ui/quote/quote_list_vm.dart b/lib/ui/quote/quote_list_vm.dart index e3a1207a3..2fdb03ffb 100644 --- a/lib/ui/quote/quote_list_vm.dart +++ b/lib/ui/quote/quote_list_vm.dart @@ -44,7 +44,7 @@ class QuoteListBuilder extends StatelessWidget { onSortColumn: viewModel.onSortColumn, itemBuilder: (BuildContext context, index) { final invoiceId = viewModel.invoiceList[index]; - final invoice = viewModel.invoiceMap[invoiceId]; + final invoice = viewModel.invoiceMap[invoiceId]!; return QuoteListItem( filter: viewModel.filter,