Null safety
This commit is contained in:
parent
5377657beb
commit
74b65842bf
|
|
@ -93,7 +93,7 @@ class _ClientViewDetailsState extends State<ClientViewDetails> {
|
|||
subtitle: subtitleParts.join('\n'),
|
||||
copyValue: contact.email,
|
||||
onLongPress: () => setState(() {
|
||||
if ((contact.email ?? '').isEmpty) {
|
||||
if (contact.email.isEmpty) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
);
|
||||
},
|
||||
|
|
|
|||
|
|
@ -217,7 +217,7 @@ class PurchaseOrderListItem extends StatelessWidget {
|
|||
children: <Widget>[
|
||||
Expanded(
|
||||
child: filterMatch == null
|
||||
? Text((((purchaseOrder.number ?? '').isEmpty
|
||||
? Text((((purchaseOrder.number).isEmpty
|
||||
? localization!.pending
|
||||
: purchaseOrder.number) +
|
||||
' • ' +
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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<AppState>(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: <Widget>[
|
||||
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: <Widget>[
|
||||
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: <Widget>[
|
||||
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],
|
||||
)),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue