Null safety

This commit is contained in:
Hillel Coren 2023-09-22 14:07:26 +03:00
parent ce32f99e89
commit b496b4fc0b
83 changed files with 341 additions and 207 deletions

View File

@ -964,7 +964,8 @@ abstract class GatewayEntity extends Object
} }
} }
static String? getPaymentUrl({String? gatewayId, String? transactionReference}) { static String? getPaymentUrl(
{String? gatewayId, String? transactionReference}) {
switch (gatewayId) { switch (gatewayId) {
case kGatewayStripe: case kGatewayStripe:
case kGatewayStripeConnect: case kGatewayStripeConnect:

View File

@ -90,7 +90,8 @@ abstract class DesignEntity extends Object
{String? id, AppState? state, BuiltMap<String, String>? design}) { {String? id, AppState? state, BuiltMap<String, String>? design}) {
if (design == null && state != null) { if (design == null && state != null) {
final designMap = state.designState.map; final designMap = state.designState.map;
design = designMap[state.company!.settings.defaultInvoiceDesignId]?.design; design =
designMap[state.company!.settings.defaultInvoiceDesignId]?.design;
} }
return _$DesignEntity._( return _$DesignEntity._(

View File

@ -220,8 +220,9 @@ abstract class ProjectEntity extends Object
switch (sortField) { switch (sortField) {
case ProjectFields.name: case ProjectFields.name:
response = response = projectA!.name
projectA!.name.toLowerCase().compareTo(projectB!.name.toLowerCase()); .toLowerCase()
.compareTo(projectB!.name.toLowerCase());
break; break;
case ProjectFields.taskRate: case ProjectFields.taskRate:
response = projectA!.taskRate.compareTo(projectB!.taskRate); response = projectA!.taskRate.compareTo(projectB!.taskRate);

View File

@ -56,7 +56,8 @@ class TaxRateFields {
abstract class TaxRateEntity extends Object abstract class TaxRateEntity extends Object
with BaseEntity, SelectableEntity with BaseEntity, SelectableEntity
implements Built<TaxRateEntity, TaxRateEntityBuilder> { implements Built<TaxRateEntity, TaxRateEntityBuilder> {
factory TaxRateEntity({String? id, String? name, double? rate, AppState? state}) { factory TaxRateEntity(
{String? id, String? name, double? rate, AppState? state}) {
return _$TaxRateEntity._( return _$TaxRateEntity._(
id: BaseEntity.nextId, id: BaseEntity.nextId,
isChanged: false, isChanged: false,
@ -100,8 +101,9 @@ abstract class TaxRateEntity extends Object
switch (sortField) { switch (sortField) {
case TaxRateFields.name: case TaxRateFields.name:
response = response = taxRateA!.name
taxRateA!.name.toLowerCase().compareTo(taxRateB!.name.toLowerCase()); .toLowerCase()
.compareTo(taxRateB!.name.toLowerCase());
break; break;
case TaxRateFields.rate: case TaxRateFields.rate:
response = taxRateA!.rate.compareTo(taxRateB!.rate); response = taxRateA!.rate.compareTo(taxRateB!.rate);

View File

@ -40,7 +40,8 @@ class WidgetData {
dateRanges = Map.fromIterable( dateRanges = Map.fromIterable(
DateRange.values.where((value) => value != DateRange.custom), DateRange.values.where((value) => value != DateRange.custom),
key: (dynamic item) => toSnakeCase('$item'), key: (dynamic item) => toSnakeCase('$item'),
value: (dynamic item) => localization!.lookup(toSnakeCase('$item'))); value: (dynamic item) =>
localization!.lookup(toSnakeCase('$item')));
WidgetData.fromJson(Map<String, dynamic> json) WidgetData.fromJson(Map<String, dynamic> json)
: url = json['url'], : url = json['url'],

View File

@ -21,7 +21,8 @@ class GroupRepository {
final WebClient webClient; final WebClient webClient;
Future<GroupEntity> loadItem(Credentials credentials, String? entityId) async { Future<GroupEntity> loadItem(
Credentials credentials, String? entityId) async {
final dynamic response = await webClient.get( final dynamic response = await webClient.get(
'${credentials.url}/group_settings/$entityId', credentials.token); '${credentials.url}/group_settings/$entityId', credentials.token);

View File

@ -47,8 +47,8 @@ class TaxRateRepository {
ids = ids.sublist(0, kMaxEntitiesPerBulkAction); ids = ids.sublist(0, kMaxEntitiesPerBulkAction);
} }
final url = final url = credentials.url! +
credentials.url! + '/tax_rates/bulk?per_page=$kMaxEntitiesPerBulkAction'; '/tax_rates/bulk?per_page=$kMaxEntitiesPerBulkAction';
final dynamic response = await webClient.post(url, credentials.token, final dynamic response = await webClient.post(url, credentials.token,
data: json.encode({'ids': ids, 'action': action.toApiParam()})); data: json.encode({'ids': ids, 'action': action.toApiParam()}));

View File

@ -19,7 +19,8 @@ class TokenRepository {
final WebClient webClient; final WebClient webClient;
Future<TokenEntity> loadItem(Credentials credentials, String? entityId) async { Future<TokenEntity> loadItem(
Credentials credentials, String? entityId) async {
final dynamic response = await webClient.get( final dynamic response = await webClient.get(
'${credentials.url}/tokens/$entityId', credentials.token); '${credentials.url}/tokens/$entityId', credentials.token);

View File

@ -22,10 +22,14 @@ final forceSelectedReducer = combineReducers<bool?>([
TypedReducer<bool?, ViewBankAccountList>((completer, action) => false), TypedReducer<bool?, ViewBankAccountList>((completer, action) => false),
TypedReducer<bool?, FilterBankAccountsByState>((completer, action) => false), TypedReducer<bool?, FilterBankAccountsByState>((completer, action) => false),
TypedReducer<bool?, FilterBankAccounts>((completer, action) => false), TypedReducer<bool?, FilterBankAccounts>((completer, action) => false),
TypedReducer<bool?, FilterBankAccountsByCustom1>((completer, action) => false), TypedReducer<bool?, FilterBankAccountsByCustom1>(
TypedReducer<bool?, FilterBankAccountsByCustom2>((completer, action) => false), (completer, action) => false),
TypedReducer<bool?, FilterBankAccountsByCustom3>((completer, action) => false), TypedReducer<bool?, FilterBankAccountsByCustom2>(
TypedReducer<bool?, FilterBankAccountsByCustom4>((completer, action) => false), (completer, action) => false),
TypedReducer<bool?, FilterBankAccountsByCustom3>(
(completer, action) => false),
TypedReducer<bool?, FilterBankAccountsByCustom4>(
(completer, action) => false),
]); ]);
final int? Function(int, dynamic) tabIndexReducer = combineReducers<int?>([ final int? Function(int, dynamic) tabIndexReducer = combineReducers<int?>([
@ -54,10 +58,14 @@ Reducer<String?> selectedIdReducer = combineReducers([
TypedReducer<String?, SortBankAccounts>((selectedId, action) => ''), TypedReducer<String?, SortBankAccounts>((selectedId, action) => ''),
TypedReducer<String?, FilterBankAccounts>((selectedId, action) => ''), TypedReducer<String?, FilterBankAccounts>((selectedId, action) => ''),
TypedReducer<String?, FilterBankAccountsByState>((selectedId, action) => ''), TypedReducer<String?, FilterBankAccountsByState>((selectedId, action) => ''),
TypedReducer<String?, FilterBankAccountsByCustom1>((selectedId, action) => ''), TypedReducer<String?, FilterBankAccountsByCustom1>(
TypedReducer<String?, FilterBankAccountsByCustom2>((selectedId, action) => ''), (selectedId, action) => ''),
TypedReducer<String?, FilterBankAccountsByCustom3>((selectedId, action) => ''), TypedReducer<String?, FilterBankAccountsByCustom2>(
TypedReducer<String?, FilterBankAccountsByCustom4>((selectedId, action) => ''), (selectedId, action) => ''),
TypedReducer<String?, FilterBankAccountsByCustom3>(
(selectedId, action) => ''),
TypedReducer<String?, FilterBankAccountsByCustom4>(
(selectedId, action) => ''),
TypedReducer<String?, FilterByEntity>( TypedReducer<String?, FilterByEntity>(
(selectedId, action) => action.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
@ -88,7 +96,8 @@ final editingReducer = combineReducers<BankAccountEntity?>([
TypedReducer<BankAccountEntity?, DiscardChanges>(_clearEditing), TypedReducer<BankAccountEntity?, DiscardChanges>(_clearEditing),
]); ]);
BankAccountEntity _clearEditing(BankAccountEntity? bankAccount, dynamic action) { BankAccountEntity _clearEditing(
BankAccountEntity? bankAccount, dynamic action) {
return BankAccountEntity(); return BankAccountEntity();
} }

View File

@ -24,7 +24,9 @@ EntityUIState clientUIReducer(ClientUIState state, dynamic action) {
..forceSelected = forceSelectedReducer(state.forceSelected, action) ..forceSelected = forceSelectedReducer(state.forceSelected, action)
..tabIndex = tabIndexReducer(state.tabIndex, action) ..tabIndex = tabIndexReducer(state.tabIndex, action)
..saveCompleter = saveCompleterReducer(state.saveCompleter, action) ..saveCompleter = saveCompleterReducer(state.saveCompleter, action)
..cancelCompleter = cancelCompleterReducer(state.cancelCompleter as Completer<SelectableEntity>?, action) as Completer<Null>?); ..cancelCompleter = cancelCompleterReducer(
state.cancelCompleter as Completer<SelectableEntity>?, action)
as Completer<Null>?);
} }
final forceSelectedReducer = combineReducers<bool?>([ final forceSelectedReducer = combineReducers<bool?>([
@ -79,7 +81,8 @@ final selectedIdReducer = combineReducers<String?>([
TypedReducer<String?, AddClientSuccess>((selectedId, action) { TypedReducer<String?, AddClientSuccess>((selectedId, action) {
return action.client.id; return action.client.id;
}), }),
TypedReducer<String?, ShowPdfClient>((selectedId, action) => action.client!.id), TypedReducer<String?, ShowPdfClient>(
(selectedId, action) => action.client!.id),
TypedReducer<String?, SelectCompany>( TypedReducer<String?, SelectCompany>(
(selectedId, action) => action.clearSelection ? '' : selectedId), (selectedId, action) => action.clearSelection ? '' : selectedId),
TypedReducer<String?, ClearEntityFilter>((selectedId, action) => ''), TypedReducer<String?, ClearEntityFilter>((selectedId, action) => ''),

View File

@ -78,8 +78,8 @@ List<String> getCurrencyIds(
} }
} }
var memoizedFilteredSelector = memo2( var memoizedFilteredSelector = memo2((String? filter, UserCompanyState state) =>
(String? filter, UserCompanyState state) => filteredSelector(filter, state)); filteredSelector(filter, state));
List<BaseEntity?> filteredSelector(String? filter, UserCompanyState state) { List<BaseEntity?> filteredSelector(String? filter, UserCompanyState state) {
final List<BaseEntity?> list = [] final List<BaseEntity?> list = []

View File

@ -38,7 +38,8 @@ final forceSelectedReducer = combineReducers<bool?>([
]); ]);
Reducer<String?> selectedIdReducer = combineReducers([ Reducer<String?> selectedIdReducer = combineReducers([
TypedReducer<String?, ArchiveCompanyGatewaySuccess>((completer, action) => ''), TypedReducer<String?, ArchiveCompanyGatewaySuccess>(
(completer, action) => ''),
TypedReducer<String?, DeleteCompanyGatewaySuccess>((completer, action) => ''), TypedReducer<String?, DeleteCompanyGatewaySuccess>((completer, action) => ''),
TypedReducer<String?, PreviewEntity>((selectedId, action) => TypedReducer<String?, PreviewEntity>((selectedId, action) =>
action.entityType == EntityType.companyGateway action.entityType == EntityType.companyGateway
@ -72,7 +73,8 @@ Reducer<String?> selectedIdReducer = combineReducers([
]); ]);
final editingReducer = combineReducers<CompanyGatewayEntity?>([ final editingReducer = combineReducers<CompanyGatewayEntity?>([
TypedReducer<CompanyGatewayEntity?, SaveCompanyGatewaySuccess>(_updateEditing), TypedReducer<CompanyGatewayEntity?, SaveCompanyGatewaySuccess>(
_updateEditing),
TypedReducer<CompanyGatewayEntity?, AddCompanyGatewaySuccess>(_updateEditing), TypedReducer<CompanyGatewayEntity?, AddCompanyGatewaySuccess>(_updateEditing),
TypedReducer<CompanyGatewayEntity?, RestoreCompanyGatewaySuccess>( TypedReducer<CompanyGatewayEntity?, RestoreCompanyGatewaySuccess>(
(companyGateways, action) { (companyGateways, action) {

View File

@ -123,7 +123,9 @@ Middleware<AppState> _showEmailCredit() {
final emailWasSent = final emailWasSent =
await navigatorKey.currentState!.pushNamed(CreditEmailScreen.route); await navigatorKey.currentState!.pushNamed(CreditEmailScreen.route);
if (action!.completer != null && emailWasSent != null && emailWasSent as bool) { if (action!.completer != null &&
emailWasSent != null &&
emailWasSent as bool) {
action.completer!.complete(null); action.completer!.complete(null);
} }
} }

View File

@ -65,7 +65,9 @@ List<String> filteredDesignsSelector(BuiltMap<String?, DesignEntity?> designMap,
} }
String? getDesignIdForClientByEntity( String? getDesignIdForClientByEntity(
{required AppState state, required String clientId, EntityType? entityType}) { {required AppState state,
required String clientId,
EntityType? entityType}) {
final client = state.clientState.get(clientId); final client = state.clientState.get(clientId);
final settings = getClientSettings(state, client); final settings = getClientSettings(state, client);
switch (entityType) { switch (entityType) {
@ -82,7 +84,9 @@ String? getDesignIdForClientByEntity(
} }
String? getDesignIdForVendorByEntity( String? getDesignIdForVendorByEntity(
{required AppState state, required String vendorId, EntityType? entityType}) { {required AppState state,
required String vendorId,
EntityType? entityType}) {
final vendor = state.vendorState.get(vendorId); final vendor = state.vendorState.get(vendorId);
final settings = getVendorSettings(state, vendor); final settings = getVendorSettings(state, vendor);

View File

@ -307,4 +307,4 @@ Middleware<AppState> _loadDocuments(DocumentRepository repository) {
next(action); next(action);
}; };
} }
*/ */

View File

@ -21,7 +21,9 @@ EntityUIState expenseCategoryUIReducer(
..selectedId = selectedIdReducer(state.selectedId, action) ..selectedId = selectedIdReducer(state.selectedId, action)
..forceSelected = forceSelectedReducer(state.forceSelected, action) ..forceSelected = forceSelectedReducer(state.forceSelected, action)
..saveCompleter = saveCompleterReducer(state.saveCompleter, action) ..saveCompleter = saveCompleterReducer(state.saveCompleter, action)
..cancelCompleter = cancelCompleterReducer(state.cancelCompleter as Completer<SelectableEntity>?, action) as Completer<Null>?); ..cancelCompleter = cancelCompleterReducer(
state.cancelCompleter as Completer<SelectableEntity>?, action)
as Completer<Null>?);
} }
final saveCompleterReducer = combineReducers<Completer<SelectableEntity>?>([ final saveCompleterReducer = combineReducers<Completer<SelectableEntity>?>([

View File

@ -137,7 +137,8 @@ ListUIState _addToListMultiselect(
ListUIState _removeFromListMultiselect( ListUIState _removeFromListMultiselect(
ListUIState groupListState, RemoveFromGroupMultiselect action) { ListUIState groupListState, RemoveFromGroupMultiselect action) {
return groupListState.rebuild((b) => b..selectedIds.remove(action.entity!.id)); return groupListState
.rebuild((b) => b..selectedIds.remove(action.entity!.id));
} }
ListUIState _clearListMultiselect( ListUIState _clearListMultiselect(

View File

@ -128,7 +128,9 @@ Middleware<AppState> _showEmailInvoice() {
final emailWasSent = final emailWasSent =
await navigatorKey.currentState!.pushNamed(InvoiceEmailScreen.route); await navigatorKey.currentState!.pushNamed(InvoiceEmailScreen.route);
if (action!.completer != null && emailWasSent != null && emailWasSent as bool) { if (action!.completer != null &&
emailWasSent != null &&
emailWasSent as bool) {
action.completer!.complete(null); action.completer!.complete(null);
} }
} }

View File

@ -25,10 +25,14 @@ final forceSelectedReducer = combineReducers<bool?>([
TypedReducer<bool?, ViewPaymentTermList>((completer, action) => false), TypedReducer<bool?, ViewPaymentTermList>((completer, action) => false),
TypedReducer<bool?, FilterPaymentTermsByState>((completer, action) => false), TypedReducer<bool?, FilterPaymentTermsByState>((completer, action) => false),
TypedReducer<bool?, FilterPaymentTerms>((completer, action) => false), TypedReducer<bool?, FilterPaymentTerms>((completer, action) => false),
TypedReducer<bool?, FilterPaymentTermsByCustom1>((completer, action) => false), TypedReducer<bool?, FilterPaymentTermsByCustom1>(
TypedReducer<bool?, FilterPaymentTermsByCustom2>((completer, action) => false), (completer, action) => false),
TypedReducer<bool?, FilterPaymentTermsByCustom3>((completer, action) => false), TypedReducer<bool?, FilterPaymentTermsByCustom2>(
TypedReducer<bool?, FilterPaymentTermsByCustom4>((completer, action) => false), (completer, action) => false),
TypedReducer<bool?, FilterPaymentTermsByCustom3>(
(completer, action) => false),
TypedReducer<bool?, FilterPaymentTermsByCustom4>(
(completer, action) => false),
]); ]);
Reducer<String?> selectedIdReducer = combineReducers([ Reducer<String?> selectedIdReducer = combineReducers([
@ -48,10 +52,14 @@ Reducer<String?> selectedIdReducer = combineReducers([
TypedReducer<String?, SortPaymentTerms>((selectedId, action) => ''), TypedReducer<String?, SortPaymentTerms>((selectedId, action) => ''),
TypedReducer<String?, FilterPaymentTerms>((selectedId, action) => ''), TypedReducer<String?, FilterPaymentTerms>((selectedId, action) => ''),
TypedReducer<String?, FilterPaymentTermsByState>((selectedId, action) => ''), TypedReducer<String?, FilterPaymentTermsByState>((selectedId, action) => ''),
TypedReducer<String?, FilterPaymentTermsByCustom1>((selectedId, action) => ''), TypedReducer<String?, FilterPaymentTermsByCustom1>(
TypedReducer<String?, FilterPaymentTermsByCustom2>((selectedId, action) => ''), (selectedId, action) => ''),
TypedReducer<String?, FilterPaymentTermsByCustom3>((selectedId, action) => ''), TypedReducer<String?, FilterPaymentTermsByCustom2>(
TypedReducer<String?, FilterPaymentTermsByCustom4>((selectedId, action) => ''), (selectedId, action) => ''),
TypedReducer<String?, FilterPaymentTermsByCustom3>(
(selectedId, action) => ''),
TypedReducer<String?, FilterPaymentTermsByCustom4>(
(selectedId, action) => ''),
]); ]);
final editingReducer = combineReducers<PaymentTermEntity?>([ final editingReducer = combineReducers<PaymentTermEntity?>([
@ -76,7 +84,8 @@ final editingReducer = combineReducers<PaymentTermEntity?>([
TypedReducer<PaymentTermEntity?, DiscardChanges>(_clearEditing), TypedReducer<PaymentTermEntity?, DiscardChanges>(_clearEditing),
]); ]);
PaymentTermEntity _clearEditing(PaymentTermEntity? paymentTerm, dynamic action) { PaymentTermEntity _clearEditing(
PaymentTermEntity? paymentTerm, dynamic action) {
return PaymentTermEntity(); return PaymentTermEntity();
} }

View File

@ -42,8 +42,8 @@ InvoiceItemEntity convertProductToInvoiceItem({
if (!company.convertRateToClient && exchangeRate != 0) { if (!company.convertRateToClient && exchangeRate != 0) {
exchangeRate = 1 / exchangeRate; exchangeRate = 1 / exchangeRate;
} }
cost = cost = round(
round(cost * exchangeRate, currencyMap[client!.currencyId]!.precision); cost * exchangeRate, currencyMap[client!.currencyId]!.precision);
} }
return InvoiceItemEntity().rebuild((b) => b return InvoiceItemEntity().rebuild((b) => b
@ -69,7 +69,8 @@ InvoiceItemEntity convertProductToInvoiceItem({
} }
var memoizedDropdownProductList = memo3( var memoizedDropdownProductList = memo3(
(BuiltMap<String?, ProductEntity?> productMap, BuiltList<String> productList, (BuiltMap<String?, ProductEntity?> productMap,
BuiltList<String> productList,
BuiltMap<String?, UserEntity?> userMap) => BuiltMap<String?, UserEntity?> userMap) =>
dropdownProductsSelector(productMap, productList, userMap)); dropdownProductsSelector(productMap, productList, userMap));
@ -77,8 +78,9 @@ List<String> dropdownProductsSelector(
BuiltMap<String?, ProductEntity?> productMap, BuiltMap<String?, ProductEntity?> productMap,
BuiltList<String> productList, BuiltList<String> productList,
BuiltMap<String?, UserEntity?> userMap) { BuiltMap<String?, UserEntity?> userMap) {
final list = final list = productList
productList.where((productId) => productMap[productId]!.isActive).toList(); .where((productId) => productMap[productId]!.isActive)
.toList();
list.sort((productAId, productBId) { list.sort((productAId, productBId) {
final productA = productMap[productAId]!; final productA = productMap[productAId]!;

View File

@ -23,7 +23,9 @@ EntityUIState projectUIReducer(ProjectUIState state, dynamic action) {
..forceSelected = forceSelectedReducer(state.forceSelected, action) ..forceSelected = forceSelectedReducer(state.forceSelected, action)
..tabIndex = tabIndexReducer(state.tabIndex, action) ..tabIndex = tabIndexReducer(state.tabIndex, action)
..saveCompleter = saveCompleterReducer(state.saveCompleter, action) ..saveCompleter = saveCompleterReducer(state.saveCompleter, action)
..cancelCompleter = cancelCompleterReducer(state.cancelCompleter as Completer<SelectableEntity>?, action) as Completer<Null>?); ..cancelCompleter = cancelCompleterReducer(
state.cancelCompleter as Completer<SelectableEntity>?, action)
as Completer<Null>?);
} }
final forceSelectedReducer = combineReducers<bool?>([ final forceSelectedReducer = combineReducers<bool?>([

View File

@ -144,7 +144,9 @@ Middleware<AppState> _showEmailPurchaseOrder() {
final emailWasSent = await navigatorKey.currentState! final emailWasSent = await navigatorKey.currentState!
.pushNamed(PurchaseOrderEmailScreen.route); .pushNamed(PurchaseOrderEmailScreen.route);
if (action!.completer != null && emailWasSent != null && emailWasSent as bool) { if (action!.completer != null &&
emailWasSent != null &&
emailWasSent as bool) {
action.completer!.complete(null); action.completer!.complete(null);
} }
} }

View File

@ -128,7 +128,9 @@ Middleware<AppState> _showEmailQuote() {
final emailWasSent = final emailWasSent =
await navigatorKey.currentState!.pushNamed(QuoteEmailScreen.route); await navigatorKey.currentState!.pushNamed(QuoteEmailScreen.route);
if (action!.completer != null && emailWasSent != null && emailWasSent as bool) { if (action!.completer != null &&
emailWasSent != null &&
emailWasSent as bool) {
action.completer!.complete(null); action.completer!.complete(null);
} }
} }

View File

@ -200,7 +200,8 @@ Middleware<AppState> _updatePricesRecurringInvoice(
} }
}).catchError((Object error) { }).catchError((Object error) {
print(error); print(error);
store.dispatch(UpdatePricesRecurringInvoicesFailure(error as List<InvoiceEntity>)); store.dispatch(
UpdatePricesRecurringInvoicesFailure(error as List<InvoiceEntity>));
if (action.completer != null) { if (action.completer != null) {
action.completer!.completeError(error); action.completer!.completeError(error);
} }
@ -225,7 +226,8 @@ Middleware<AppState> _increasePricesRecurringInvoice(
} }
}).catchError((Object error) { }).catchError((Object error) {
print(error); print(error);
store.dispatch(IncreasePricesRecurringInvoicesFailure(error as List<InvoiceEntity>)); store.dispatch(
IncreasePricesRecurringInvoicesFailure(error as List<InvoiceEntity>));
if (action.completer != null) { if (action.completer != null) {
action.completer!.completeError(error); action.completer!.completeError(error);
} }
@ -249,7 +251,8 @@ Middleware<AppState> _sendNowRecurringInvoice(
} }
}).catchError((Object error) { }).catchError((Object error) {
print(error); print(error);
store.dispatch(SendNowRecurringInvoicesFailure(error as List<InvoiceEntity>)); store.dispatch(
SendNowRecurringInvoicesFailure(error as List<InvoiceEntity>));
if (action.completer != null) { if (action.completer != null) {
action.completer.completeError(error); action.completer.completeError(error);
} }

View File

@ -21,7 +21,8 @@ List<String?> countryList(BuiltMap<String?, CountryEntity?> countryMap) {
} }
var memoizedCountryIso2Map = memo1( var memoizedCountryIso2Map = memo1(
(BuiltMap<String?, CountryEntity?> countryMap) => countryIso2Map(countryMap)); (BuiltMap<String?, CountryEntity?> countryMap) =>
countryIso2Map(countryMap));
Map<String, CountryEntity> countryIso2Map( Map<String, CountryEntity> countryIso2Map(
BuiltMap<String?, CountryEntity?> countryMap) { BuiltMap<String?, CountryEntity?> countryMap) {
@ -92,7 +93,8 @@ var memoizedDateFormatList = memo1(
(BuiltMap<String?, DateFormatEntity?> dateFormatMap) => (BuiltMap<String?, DateFormatEntity?> dateFormatMap) =>
dateFormatList(dateFormatMap)); dateFormatList(dateFormatMap));
List<String?> dateFormatList(BuiltMap<String?, DateFormatEntity?> dateFormatMap) { List<String?> dateFormatList(
BuiltMap<String?, DateFormatEntity?> dateFormatMap) {
final list = dateFormatMap.keys.toList(); final list = dateFormatMap.keys.toList();
list.sort((idA, idB) => dateFormatMap[idA]! list.sort((idA, idB) => dateFormatMap[idA]!

View File

@ -25,10 +25,14 @@ final forceSelectedReducer = combineReducers<bool?>([
TypedReducer<bool?, ViewTaskStatusList>((completer, action) => false), TypedReducer<bool?, ViewTaskStatusList>((completer, action) => false),
TypedReducer<bool?, FilterTaskStatusesByState>((completer, action) => false), TypedReducer<bool?, FilterTaskStatusesByState>((completer, action) => false),
TypedReducer<bool?, FilterTaskStatuses>((completer, action) => false), TypedReducer<bool?, FilterTaskStatuses>((completer, action) => false),
TypedReducer<bool?, FilterTaskStatusesByCustom1>((completer, action) => false), TypedReducer<bool?, FilterTaskStatusesByCustom1>(
TypedReducer<bool?, FilterTaskStatusesByCustom2>((completer, action) => false), (completer, action) => false),
TypedReducer<bool?, FilterTaskStatusesByCustom3>((completer, action) => false), TypedReducer<bool?, FilterTaskStatusesByCustom2>(
TypedReducer<bool?, FilterTaskStatusesByCustom4>((completer, action) => false), (completer, action) => false),
TypedReducer<bool?, FilterTaskStatusesByCustom3>(
(completer, action) => false),
TypedReducer<bool?, FilterTaskStatusesByCustom4>(
(completer, action) => false),
]); ]);
Reducer<String?> selectedIdReducer = combineReducers([ Reducer<String?> selectedIdReducer = combineReducers([
@ -48,10 +52,14 @@ Reducer<String?> selectedIdReducer = combineReducers([
TypedReducer<String?, SortTaskStatuses>((selectedId, action) => ''), TypedReducer<String?, SortTaskStatuses>((selectedId, action) => ''),
TypedReducer<String?, FilterTaskStatuses>((selectedId, action) => ''), TypedReducer<String?, FilterTaskStatuses>((selectedId, action) => ''),
TypedReducer<String?, FilterTaskStatusesByState>((selectedId, action) => ''), TypedReducer<String?, FilterTaskStatusesByState>((selectedId, action) => ''),
TypedReducer<String?, FilterTaskStatusesByCustom1>((selectedId, action) => ''), TypedReducer<String?, FilterTaskStatusesByCustom1>(
TypedReducer<String?, FilterTaskStatusesByCustom2>((selectedId, action) => ''), (selectedId, action) => ''),
TypedReducer<String?, FilterTaskStatusesByCustom3>((selectedId, action) => ''), TypedReducer<String?, FilterTaskStatusesByCustom2>(
TypedReducer<String?, FilterTaskStatusesByCustom4>((selectedId, action) => ''), (selectedId, action) => ''),
TypedReducer<String?, FilterTaskStatusesByCustom3>(
(selectedId, action) => ''),
TypedReducer<String?, FilterTaskStatusesByCustom4>(
(selectedId, action) => ''),
TypedReducer<String?, FilterByEntity>( TypedReducer<String?, FilterByEntity>(
(selectedId, action) => action.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''

View File

@ -155,7 +155,8 @@ EntityStats taskStatsForTaskStatus(
return EntityStats(countActive: countActive, countArchived: countArchived); return EntityStats(countActive: countActive, countArchived: countArchived);
} }
String? defaultTaskStatusId(BuiltMap<String?, TaskStatusEntity?> taskStatusMap) { String? defaultTaskStatusId(
BuiltMap<String?, TaskStatusEntity?> taskStatusMap) {
final statusIds = taskStatusMap.keys.where((statusId) { final statusIds = taskStatusMap.keys.where((statusId) {
final status = taskStatusMap[statusId]!; final status = taskStatusMap[statusId]!;
return status.isActive; return status.isActive;

View File

@ -23,10 +23,14 @@ final forceSelectedReducer = combineReducers<bool?>([
TypedReducer<bool?, FilterTransactionsByState>((completer, action) => false), TypedReducer<bool?, FilterTransactionsByState>((completer, action) => false),
TypedReducer<bool?, FilterTransactionsByStatus>((completer, action) => false), TypedReducer<bool?, FilterTransactionsByStatus>((completer, action) => false),
TypedReducer<bool?, FilterTransactions>((completer, action) => false), TypedReducer<bool?, FilterTransactions>((completer, action) => false),
TypedReducer<bool?, FilterTransactionsByCustom1>((completer, action) => false), TypedReducer<bool?, FilterTransactionsByCustom1>(
TypedReducer<bool?, FilterTransactionsByCustom2>((completer, action) => false), (completer, action) => false),
TypedReducer<bool?, FilterTransactionsByCustom3>((completer, action) => false), TypedReducer<bool?, FilterTransactionsByCustom2>(
TypedReducer<bool?, FilterTransactionsByCustom4>((completer, action) => false), (completer, action) => false),
TypedReducer<bool?, FilterTransactionsByCustom3>(
(completer, action) => false),
TypedReducer<bool?, FilterTransactionsByCustom4>(
(completer, action) => false),
]); ]);
final int? Function(int, dynamic) tabIndexReducer = combineReducers<int?>([ final int? Function(int, dynamic) tabIndexReducer = combineReducers<int?>([
@ -56,10 +60,14 @@ Reducer<String?> selectedIdReducer = combineReducers([
TypedReducer<String?, FilterTransactions>((selectedId, action) => ''), TypedReducer<String?, FilterTransactions>((selectedId, action) => ''),
TypedReducer<String?, FilterTransactionsByState>((selectedId, action) => ''), TypedReducer<String?, FilterTransactionsByState>((selectedId, action) => ''),
TypedReducer<String?, FilterTransactionsByStatus>((selectedId, action) => ''), TypedReducer<String?, FilterTransactionsByStatus>((selectedId, action) => ''),
TypedReducer<String?, FilterTransactionsByCustom1>((selectedId, action) => ''), TypedReducer<String?, FilterTransactionsByCustom1>(
TypedReducer<String?, FilterTransactionsByCustom2>((selectedId, action) => ''), (selectedId, action) => ''),
TypedReducer<String?, FilterTransactionsByCustom3>((selectedId, action) => ''), TypedReducer<String?, FilterTransactionsByCustom2>(
TypedReducer<String?, FilterTransactionsByCustom4>((selectedId, action) => ''), (selectedId, action) => ''),
TypedReducer<String?, FilterTransactionsByCustom3>(
(selectedId, action) => ''),
TypedReducer<String?, FilterTransactionsByCustom4>(
(selectedId, action) => ''),
TypedReducer<String?, FilterByEntity>( TypedReducer<String?, FilterByEntity>(
(selectedId, action) => action.clearSelection (selectedId, action) => action.clearSelection
? '' ? ''
@ -90,7 +98,8 @@ final editingReducer = combineReducers<TransactionEntity?>([
TypedReducer<TransactionEntity?, DiscardChanges>(_clearEditing), TypedReducer<TransactionEntity?, DiscardChanges>(_clearEditing),
]); ]);
TransactionEntity _clearEditing(TransactionEntity? transaction, dynamic action) { TransactionEntity _clearEditing(
TransactionEntity? transaction, dynamic action) {
return TransactionEntity(); return TransactionEntity();
} }

View File

@ -61,7 +61,8 @@ List<String> filteredTransactionRulesSelector(
return false; return false;
} else {} } else {}
if (!transactionRule!.matchesStates(transactionRuleListState.stateFilters)) { if (!transactionRule!
.matchesStates(transactionRuleListState.stateFilters)) {
return false; return false;
} }

View File

@ -36,7 +36,8 @@ Reducer<String?> selectedIdReducer = combineReducers([
TypedReducer<String?, DeleteUserSuccess>((completer, action) => ''), TypedReducer<String?, DeleteUserSuccess>((completer, action) => ''),
TypedReducer<String?, PreviewEntity>((selectedId, action) => TypedReducer<String?, PreviewEntity>((selectedId, action) =>
action.entityType == EntityType.user ? action.entityId : selectedId), action.entityType == EntityType.user ? action.entityId : selectedId),
TypedReducer<String?, ViewUser>((String? selectedId, action) => action.userId), TypedReducer<String?, ViewUser>(
(String? selectedId, action) => action.userId),
TypedReducer<String?, AddUserSuccess>( TypedReducer<String?, AddUserSuccess>(
(String? selectedId, action) => action.user.id), (String? selectedId, action) => action.user.id),
TypedReducer<String?, SelectCompany>( TypedReducer<String?, SelectCompany>(

View File

@ -99,8 +99,8 @@ List<String?> gmailUserList(BuiltMap<String?, UserEntity?> userMap) {
}).toList(); }).toList();
} }
var memoizedMicrosoftUserList = var memoizedMicrosoftUserList = memo1(
memo1((BuiltMap<String?, UserEntity?> userMap) => microsoftUserList(userMap)); (BuiltMap<String?, UserEntity?> userMap) => microsoftUserList(userMap));
List<String?> microsoftUserList(BuiltMap<String?, UserEntity?> userMap) { List<String?> microsoftUserList(BuiltMap<String?, UserEntity?> userMap) {
return userList(userMap).where((userId) { return userList(userMap).where((userId) {

View File

@ -24,7 +24,9 @@ EntityUIState vendorUIReducer(VendorUIState state, dynamic action) {
..forceSelected = forceSelectedReducer(state.forceSelected, action) ..forceSelected = forceSelectedReducer(state.forceSelected, action)
..tabIndex = tabIndexReducer(state.tabIndex, action) ..tabIndex = tabIndexReducer(state.tabIndex, action)
..saveCompleter = saveCompleterReducer(state.saveCompleter, action) ..saveCompleter = saveCompleterReducer(state.saveCompleter, action)
..cancelCompleter = cancelCompleterReducer(state.cancelCompleter as Completer<SelectableEntity>?, action) as Completer<Null>?); ..cancelCompleter = cancelCompleterReducer(
state.cancelCompleter as Completer<SelectableEntity>?, action)
as Completer<Null>?);
} }
final forceSelectedReducer = combineReducers<bool?>([ final forceSelectedReducer = combineReducers<bool?>([

View File

@ -114,8 +114,11 @@ var memoizedCalculateVendorBalance = memo4((String vendorId,
BuiltList<String> expenseList) => BuiltList<String> expenseList) =>
calculateVendorBalance(vendorId, currencyId, expenseMap, expenseList)); calculateVendorBalance(vendorId, currencyId, expenseMap, expenseList));
double calculateVendorBalance(String vendorId, String currencyId, double calculateVendorBalance(
BuiltMap<String?, ExpenseEntity?> expenseMap, BuiltList<String> expenseList) { String vendorId,
String currencyId,
BuiltMap<String?, ExpenseEntity?> expenseMap,
BuiltList<String> expenseList) {
double total = 0; double total = 0;
expenseList.forEach((expenseId) { expenseList.forEach((expenseId) {

View File

@ -88,7 +88,9 @@ class BottomButtons extends StatelessWidget {
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: textColor.withOpacity( color: textColor.withOpacity(
action2Enabled && !entity!.isDeleted! ? 1 : .6)), action2Enabled && !entity!.isDeleted!
? 1
: .6)),
), ),
], ],
), ),

View File

@ -51,7 +51,8 @@ class ConfirmEmail extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.only(bottom: kTableColumnGap), padding: const EdgeInsets.only(bottom: kTableColumnGap),
child: TextButton( child: TextButton(
onPressed: viewModel.onResendPressed as void Function()?, onPressed:
viewModel.onResendPressed as void Function()?,
child: Text(localization.resendEmail.toUpperCase()), child: Text(localization.resendEmail.toUpperCase()),
), ),
), ),
@ -91,14 +92,16 @@ class ConfirmEmail extends StatelessWidget {
Padding( Padding(
padding: const EdgeInsets.only(bottom: kTableColumnGap), padding: const EdgeInsets.only(bottom: kTableColumnGap),
child: TextButton( child: TextButton(
onPressed: viewModel.onRefreshPressed as void Function()?, onPressed:
viewModel.onRefreshPressed as void Function()?,
child: Text(localization.refreshData.toUpperCase()), child: Text(localization.refreshData.toUpperCase()),
), ),
), ),
Padding( Padding(
padding: const EdgeInsets.only(bottom: kTableColumnGap), padding: const EdgeInsets.only(bottom: kTableColumnGap),
child: TextButton( child: TextButton(
onPressed: viewModel.onLogoutPressed as void Function()?, onPressed:
viewModel.onLogoutPressed as void Function()?,
child: Text(localization.logout.toUpperCase()), child: Text(localization.logout.toUpperCase()),
), ),
), ),

View File

@ -190,7 +190,8 @@ class EditScaffold extends StatelessWidget {
entity != null && entity != null &&
entity!.isOld) ...[ entity!.isOld) ...[
EntityStatusChip( EntityStatusChip(
entity: state.getEntity(entity!.entityType, entity!.id)), entity:
state.getEntity(entity!.entityType, entity!.id)),
SizedBox(width: 8), SizedBox(width: 8),
], ],
if (showOverflow) if (showOverflow)
@ -437,32 +438,37 @@ class EditScaffold extends StatelessWidget {
itemBuilder: (BuildContext context) => itemBuilder: (BuildContext context) =>
<PopupMenuEntry<EntityAction>>[ <PopupMenuEntry<EntityAction>>[
...actions! ...actions!
.map((action) => action == null .map((action) => action == null
? PopupMenuDivider() ? PopupMenuDivider()
: PopupMenuItem<EntityAction>( : PopupMenuItem<EntityAction>(
child: Row( child: Row(
children: <Widget>[ children: <Widget>[
Icon( Icon(
getEntityActionIcon(action), getEntityActionIcon(action),
color: Theme.of(context) color: Theme.of(context)
.colorScheme .colorScheme
.secondary, .secondary,
),
SizedBox(width: 16.0),
Text(AppLocalization.of(
context)!
.lookup(
action.toString())!),
],
), ),
SizedBox(width: 16.0), value: action,
Text(AppLocalization.of(context)! ))
.lookup(action.toString())!), .toList()
], as Iterable<PopupMenuEntry<EntityAction>>
),
value: action,
))
.toList() as Iterable<PopupMenuEntry<EntityAction>>
], ],
onSelected: (action) => onSelected: (action) =>
onActionPressed!(context, action), onActionPressed!(context, action),
enabled: isEnabled, enabled: isEnabled,
) )
], ],
bottom: isFullscreen && isDesktop(context) ? null : appBarBottom as PreferredSizeWidget?, bottom: isFullscreen && isDesktop(context)
? null
: appBarBottom as PreferredSizeWidget?,
), ),
bottomNavigationBar: bottomNavigationBar, bottomNavigationBar: bottomNavigationBar,
floatingActionButtonLocation: floatingActionButtonLocation:

View File

@ -32,8 +32,8 @@ class NotificationSettings extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
final state = StoreProvider.of<AppState>(context).state; final state = StoreProvider.of<AppState>(context).state;
final localization = AppLocalization.of(context)!; final localization = AppLocalization.of(context)!;
final notifications = final notifications = user.userCompany!.notifications ??
user.userCompany!.notifications ?? BuiltMap<String, BuiltList<String>>(); BuiltMap<String, BuiltList<String>>();
final BuiltList<String> emailNotifications = final BuiltList<String> emailNotifications =
notifications.containsKey(kNotificationChannelEmail) notifications.containsKey(kNotificationChannelEmail)
? notifications[kNotificationChannelEmail]! ? notifications[kNotificationChannelEmail]!

View File

@ -113,7 +113,8 @@ class ListScaffold extends StatelessWidget {
if (isDesktop(context) && onCheckboxPressed != null) if (isDesktop(context) && onCheckboxPressed != null)
IconButton( IconButton(
icon: Icon(Icons.check_box), icon: Icon(Icons.check_box),
tooltip: prefState.enableTooltips ? localization!.multiselect : null, tooltip:
prefState.enableTooltips ? localization!.multiselect : null,
onPressed: state.prefState.showKanban && onPressed: state.prefState.showKanban &&
state.uiState.mainRoute == '${EntityType.task}' state.uiState.mainRoute == '${EntityType.task}'
? null ? null

View File

@ -29,7 +29,8 @@ class ListFilterMessage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final state = StoreProvider.of<AppState>(context).state; final state = StoreProvider.of<AppState>(context).state;
final filteredEntity = state.getEntityMap(filterEntityType)![filterEntityId]; final filteredEntity =
state.getEntityMap(filterEntityType)![filterEntityId];
return Material( return Material(
color: Colors.orange, color: Colors.orange,

View File

@ -43,7 +43,8 @@ class CachedImage extends StatelessWidget {
url!, url!,
width: width, width: width,
height: height, height: height,
key: ValueKey(url! + (apiToken != null ? apiToken!.substring(0, 8) : '')), key: ValueKey(
url! + (apiToken != null ? apiToken!.substring(0, 8) : '')),
fit: BoxFit.contain, fit: BoxFit.contain,
headers: apiToken != null ? {'X-API-TOKEN': apiToken!} : null, headers: apiToken != null ? {'X-API-TOKEN': apiToken!} : null,
); );

View File

@ -124,7 +124,9 @@ class ClientListItem extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Text( Text(
client!.displayName + client!.displayName +
(client!.documents.isNotEmpty ? ' 📎' : ''), (client!.documents.isNotEmpty
? ' 📎'
: ''),
style: textStyle), style: textStyle),
if (filterMatch != null) if (filterMatch != null)
Text( Text(

View File

@ -355,7 +355,8 @@ class _ClientPdfViewState extends State<ClientPdfView> {
fileName, _response!.bodyBytes); fileName, _response!.bodyBytes);
} else { } else {
final directory = await (isDesktopOS() final directory = await (isDesktopOS()
? getDownloadsDirectory() as FutureOr<file.Directory> ? getDownloadsDirectory()
as FutureOr<file.Directory>
: getApplicationDocumentsDirectory()); : getApplicationDocumentsDirectory());
String filePath = String filePath =
'${directory.path}${file.Platform.pathSeparator}$fileName'; '${directory.path}${file.Platform.pathSeparator}$fileName';

View File

@ -120,7 +120,8 @@ class ClientPresenter extends EntityPresenter {
formatNumber(client!.paidToDate, context, clientId: client.id)!), formatNumber(client!.paidToDate, context, clientId: client.id)!),
); );
case ClientFields.country: case ClientFields.country:
return Text(state.staticState.countryMap[client!.countryId]?.name ?? ''); return Text(
state.staticState.countryMap[client!.countryId]?.name ?? '');
case ClientFields.language: case ClientFields.language:
return Text( return Text(
state.staticState.languageMap[client!.languageId]?.name ?? ''); state.staticState.languageMap[client!.languageId]?.name ?? '');

View File

@ -46,8 +46,8 @@ class _ClientEditContactsState extends State<ClientEditContacts> {
key: Key(contact!.entityKey), key: Key(contact!.entityKey),
contact: contact, contact: contact,
isDialog: client.contacts.length > 1, isDialog: client.contacts.length > 1,
index: client.contacts index: client.contacts.indexOf(
.indexOf(client.contacts.firstWhere((c) => c!.id == contact.id)), client.contacts.firstWhere((c) => c!.id == contact.id)),
); );
}); });
} }
@ -148,8 +148,9 @@ class ContactListTile extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
)), )),
subtitle: Text( subtitle: Text(contact!.email.isNotEmpty
contact!.email.isNotEmpty ? contact!.email : contact!.phone), ? contact!.email
: contact!.phone),
trailing: Icon(Icons.navigate_next), trailing: Icon(Icons.navigate_next),
), ),
Divider( Divider(
@ -365,8 +366,8 @@ class ContactEditDetailsState extends State<ContactEditDetails> {
title: Text(localization.addToInvoices!), title: Text(localization.addToInvoices!),
value: _contact!.sendEmail, value: _contact!.sendEmail,
onChanged: (value) { onChanged: (value) {
setState(() => setState(() => _contact =
_contact = _contact!.rebuild((b) => b..sendEmail = value)); _contact!.rebuild((b) => b..sendEmail = value));
viewModel.onChangedContact( viewModel.onChangedContact(
_contact!.rebuild((b) => b..sendEmail = value), _contact!.rebuild((b) => b..sendEmail = value),

View File

@ -95,7 +95,8 @@ class _ClientViewLedgerState extends State<ClientViewLedger> {
return ListTile( return ListTile(
onTap: () => viewEntity(entity: entity as BaseEntity), onTap: () => viewEntity(entity: entity as BaseEntity),
onLongPress: () => showEntityActionsDialog(entities: [entity as BaseEntity?]), onLongPress: () =>
showEntityActionsDialog(entities: [entity as BaseEntity?]),
title: Row( title: Row(
mainAxisSize: MainAxisSize.max, mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,

View File

@ -113,7 +113,8 @@ class _CompanyGatewayOverview extends StatelessWidget {
final webhookUrl = final webhookUrl =
'${state.account!.defaultUrl}/payment_webhook/${state.company!.companyKey}/${companyGateway.id}'; '${state.account!.defaultUrl}/payment_webhook/${state.company!.companyKey}/${companyGateway.id}';
final Map<String, Map<String, String?>> allFields = <String, Map<String, String>>{}; final Map<String, Map<String, String?>> allFields =
<String, Map<String, String>>{};
for (var gatewayTypeId in kGatewayTypes.keys) { for (var gatewayTypeId in kGatewayTypes.keys) {
final Map<String, String?> fields = {}; final Map<String, String?> fields = {};
if (companyGateway.feesAndLimitsMap.containsKey(gatewayTypeId)) { if (companyGateway.feesAndLimitsMap.containsKey(gatewayTypeId)) {

View File

@ -117,8 +117,8 @@ class CreditPresenter extends EntityPresenter {
case CreditFields.documents: case CreditFields.documents:
return Text('${credit.documents.length}'); return Text('${credit.documents.length}');
case CreditFields.taxAmount: case CreditFields.taxAmount:
return Text( return Text(formatNumber(credit.taxAmount, context,
formatNumber(credit.taxAmount, context, clientId: credit.clientId)!); clientId: credit.clientId)!);
case CreditFields.exchangeRate: case CreditFields.exchangeRate:
return Text(formatNumber(credit.exchangeRate, context, return Text(formatNumber(credit.exchangeRate, context,
formatNumberType: FormatNumberType.double)!); formatNumberType: FormatNumberType.double)!);
@ -137,7 +137,8 @@ class CreditPresenter extends EntityPresenter {
case CreditFields.clientPostalCode: case CreditFields.clientPostalCode:
return Text(client!.postalCode); return Text(client!.postalCode);
case CreditFields.clientCountry: case CreditFields.clientCountry:
return Text(state.staticState.countryMap[client!.countryId]?.name ?? ''); return Text(
state.staticState.countryMap[client!.countryId]?.name ?? '');
case CreditFields.contactName: case CreditFields.contactName:
case CreditFields.contactEmail: case CreditFields.contactEmail:
final contact = creditContactSelector( final contact = creditContactSelector(

View File

@ -47,7 +47,8 @@ class _DesignViewState extends State<DesignView> {
count += state.invoiceState.list count += state.invoiceState.list
.map((invoiceId) => state.invoiceState.map[invoiceId]) .map((invoiceId) => state.invoiceState.map[invoiceId])
.where((invoice) => !invoice!.isDeleted! && invoice.designId == design.id) .where(
(invoice) => !invoice!.isDeleted! && invoice.designId == design.id)
.length; .length;
count += state.quoteState.list count += state.quoteState.list
@ -62,7 +63,8 @@ class _DesignViewState extends State<DesignView> {
count += state.recurringInvoiceState.list count += state.recurringInvoiceState.list
.map((invoiceId) => state.recurringInvoiceState.map[invoiceId]) .map((invoiceId) => state.recurringInvoiceState.map[invoiceId])
.where((invoice) => !invoice!.isDeleted! && invoice.designId == design.id) .where(
(invoice) => !invoice!.isDeleted! && invoice.designId == design.id)
.length; .length;
return ViewScaffold( return ViewScaffold(

View File

@ -85,8 +85,9 @@ class _DocumentEditState extends State<DocumentEdit> {
return EditScaffold( return EditScaffold(
entity: document, entity: document,
title: title: document.isNew
document.isNew ? localization!.newDocument : localization!.editDocument, ? localization!.newDocument
: localization!.editDocument,
onSavePressed: (_) => _onSavePressed(), onSavePressed: (_) => _onSavePressed(),
onCancelPressed: (context) => viewModel.onCancelPressed(context), onCancelPressed: (context) => viewModel.onCancelPressed(context),
body: Form( body: Form(

View File

@ -125,8 +125,8 @@ class ExpenseEditNotesState extends State<ExpenseEditNotes> {
SizedBox(height: 8), SizedBox(height: 8),
DocumentGrid( DocumentGrid(
documents: expense.documents.toList(), documents: expense.documents.toList(),
onUploadDocument: (path, isPrivate) => widget.viewModel onUploadDocument: (path, isPrivate) => widget
.onUploadDocument!(context, path, isPrivate), .viewModel.onUploadDocument!(context, path, isPrivate),
onRenamedDocument: () => onRenamedDocument: () =>
store.dispatch(LoadExpense(expenseId: expense.id)), store.dispatch(LoadExpense(expenseId: expense.id)),
) )

View File

@ -97,8 +97,8 @@ class ExpensePresenter extends EntityPresenter {
case ExpenseFields.transactionReference: case ExpenseFields.transactionReference:
return Text(expense!.transactionReference); return Text(expense!.transactionReference);
case ExpenseFields.currency: case ExpenseFields.currency:
return Text(state return Text(state.staticState.currencyMap[expense!.currencyId]
.staticState.currencyMap[expense!.currencyId]?.listDisplayName ?? ?.listDisplayName ??
''); '');
case ExpenseFields.category: case ExpenseFields.category:
final category = state.expenseCategoryState.map[expense!.categoryId]; final category = state.expenseCategoryState.map[expense!.categoryId];

View File

@ -10,8 +10,7 @@ import 'package:invoiceninja_flutter/ui/app/document_grid.dart';
import 'package:invoiceninja_flutter/ui/expense/view/expense_view_vm.dart'; import 'package:invoiceninja_flutter/ui/expense/view/expense_view_vm.dart';
class ExpenseViewDocuments extends StatelessWidget { class ExpenseViewDocuments extends StatelessWidget {
const ExpenseViewDocuments( const ExpenseViewDocuments({required this.expense, required this.viewModel});
{required this.expense, required this.viewModel});
final AbstractExpenseViewVM viewModel; final AbstractExpenseViewVM viewModel;
final ExpenseEntity? expense; final ExpenseEntity? expense;

View File

@ -94,7 +94,8 @@ class ExpenseCategoryEditVM {
UpdateCurrentRoute(ExpenseCategoryViewScreen.route)); UpdateCurrentRoute(ExpenseCategoryViewScreen.route));
if (expenseCategory.isNew && if (expenseCategory.isNew &&
state.expenseCategoryUIState.saveCompleter == null) { state.expenseCategoryUIState.saveCompleter == null) {
navigator!.pushReplacementNamed(ExpenseCategoryViewScreen.route); navigator!
.pushReplacementNamed(ExpenseCategoryViewScreen.route);
} else { } else {
navigator!.pop(savedExpenseCategory); navigator!.pop(savedExpenseCategory);
} }

View File

@ -190,7 +190,8 @@ class InvoiceListItem extends StatelessWidget {
: ListTile( : ListTile(
onTap: () => onTap != null onTap: () => onTap != null
? onTap!() ? onTap!()
: selectEntity(entity: invoice!, forceView: !showCheckbox), : selectEntity(
entity: invoice!, forceView: !showCheckbox),
onLongPress: () => onTap != null onLongPress: () => onTap != null
? null ? null
: selectEntity(entity: invoice!, longPress: true), : selectEntity(entity: invoice!, longPress: true),

View File

@ -97,8 +97,8 @@ class _InvoicePdfViewState extends State<InvoicePdfView> {
_isLoading = false; _isLoading = false;
if (kIsWeb && state!.prefState.enableNativeBrowser) { if (kIsWeb && state!.prefState.enableNativeBrowser) {
_pdfString = _pdfString = 'data:application/pdf;base64,' +
'data:application/pdf;base64,' + base64Encode(response!.bodyBytes); base64Encode(response!.bodyBytes);
WebUtils.registerWebView(_pdfString); WebUtils.registerWebView(_pdfString);
} }
}); });
@ -270,7 +270,8 @@ class _InvoicePdfViewState extends State<InvoicePdfView> {
fileName, _response!.bodyBytes); fileName, _response!.bodyBytes);
} else { } else {
final directory = await (isDesktopOS() final directory = await (isDesktopOS()
? getDownloadsDirectory() as FutureOr<file.Directory> ? getDownloadsDirectory()
as FutureOr<file.Directory>
: getApplicationDocumentsDirectory()); : getApplicationDocumentsDirectory());
String filePath = String filePath =
'${directory.path}${file.Platform.pathSeparator}$fileName'; '${directory.path}${file.Platform.pathSeparator}$fileName';
@ -340,12 +341,13 @@ Future<Response?> _loadPDF(
final url = isDeliveryNote final url = isDeliveryNote
? '/invoices/${invoice.id}/delivery_note' ? '/invoices/${invoice.id}/delivery_note'
: '/activities/download_entity/$activityId'; : '/activities/download_entity/$activityId';
response = await (WebClient() response = await (WebClient().get('${credential.url}$url', credential.token,
.get('${credential.url}$url', credential.token, rawResponse: true) as FutureOr<Response?>); rawResponse: true) as FutureOr<Response?>);
} else { } else {
final invitation = invoice.invitations.first; final invitation = invoice.invitations.first;
final url = invitation.downloadLink; final url = invitation.downloadLink;
response = await (WebClient().get(url, '', rawResponse: true) as FutureOr<Response?>); response = await (WebClient().get(url, '', rawResponse: true)
as FutureOr<Response?>);
} }
if (response!.statusCode >= 400) { if (response!.statusCode >= 400) {

View File

@ -164,7 +164,8 @@ class InvoicePresenter extends EntityPresenter {
case InvoiceFields.clientPostalCode: case InvoiceFields.clientPostalCode:
return Text(client!.postalCode); return Text(client!.postalCode);
case InvoiceFields.clientCountry: case InvoiceFields.clientCountry:
return Text(state.staticState.countryMap[client!.countryId]?.name ?? ''); return Text(
state.staticState.countryMap[client!.countryId]?.name ?? '');
case InvoiceFields.contactName: case InvoiceFields.contactName:
case InvoiceFields.contactEmail: case InvoiceFields.contactEmail:
final contact = invoiceContactSelector( final contact = invoiceContactSelector(

View File

@ -93,7 +93,8 @@ class PaymentPresenter extends EntityPresenter {
case PaymentFields.amount: case PaymentFields.amount:
return Align( return Align(
alignment: Alignment.centerRight, alignment: Alignment.centerRight,
child: Text(formatNumber(payment!.amount - payment.refunded, context, child: Text(formatNumber(
payment!.amount - payment.refunded, context,
clientId: payment.clientId)!)); clientId: payment.clientId)!));
case PaymentFields.convertedAmount: case PaymentFields.convertedAmount:
return Align( return Align(
@ -124,7 +125,8 @@ class PaymentPresenter extends EntityPresenter {
state.companyGatewayState.get(payment!.companyGatewayId)!; state.companyGatewayState.get(payment!.companyGatewayId)!;
return Text(companyGateway.label); return Text(companyGateway.label);
case PaymentFields.gatewayType: case PaymentFields.gatewayType:
return Text(localization!.lookup(kGatewayTypes[payment!.gatewayTypeId])!); return Text(
localization!.lookup(kGatewayTypes[payment!.gatewayTypeId])!);
} }
return super.getField(field: field, context: context); return super.getField(field: field, context: context);

View File

@ -181,7 +181,8 @@ class ProductListItem extends StatelessWidget {
), ),
Text( Text(
formatNumber( formatNumber(
showCost ? product!.cost : product!.price, context, showCost ? product!.cost : product!.price,
context,
roundToPrecision: false)!, roundToPrecision: false)!,
style: Theme.of(context).textTheme.titleMedium), style: Theme.of(context).textTheme.titleMedium),
], ],

View File

@ -106,7 +106,8 @@ class ProductPresenter extends EntityPresenter {
return Text(formatNumber(product!.stockQuantity.toDouble(), context, return Text(formatNumber(product!.stockQuantity.toDouble(), context,
formatNumberType: FormatNumberType.int)!); formatNumberType: FormatNumberType.int)!);
case ProductFields.taxCategory: case ProductFields.taxCategory:
return Text(localization!.lookup(kTaxCategories[product!.taxCategoryId])!); return Text(
localization!.lookup(kTaxCategories[product!.taxCategoryId])!);
case ProductFields.notificationThreshold: case ProductFields.notificationThreshold:
final store = StoreProvider.of<AppState>(context); final store = StoreProvider.of<AppState>(context);
return Text(formatNumber( return Text(formatNumber(

View File

@ -135,7 +135,8 @@ class _ProjectEditState extends State<ProjectEdit> {
return EditScaffold( return EditScaffold(
entity: project, entity: project,
title: project.isNew ? localization!.newProject : localization!.editProject, title:
project.isNew ? localization!.newProject : localization!.editProject,
onCancelPressed: (context) => viewModel.onCancelPressed(context), onCancelPressed: (context) => viewModel.onCancelPressed(context),
onSavePressed: _onSavePressed, onSavePressed: _onSavePressed,
body: Form( body: Form(

View File

@ -135,7 +135,8 @@ class PurchaseOrderPresenter extends EntityPresenter {
case PurchaseOrderFields.vendorPostalCode: case PurchaseOrderFields.vendorPostalCode:
return Text(vendor!.postalCode); return Text(vendor!.postalCode);
case PurchaseOrderFields.vendorCountry: case PurchaseOrderFields.vendorCountry:
return Text(state.staticState.countryMap[client!.countryId]?.name ?? ''); return Text(
state.staticState.countryMap[client!.countryId]?.name ?? '');
case PurchaseOrderFields.contactName: case PurchaseOrderFields.contactName:
case PurchaseOrderFields.contactEmail: case PurchaseOrderFields.contactEmail:
final contact = purchaseOrderContactSelector( final contact = purchaseOrderContactSelector(

View File

@ -70,8 +70,9 @@ class QuotePresenter extends EntityPresenter {
case QuoteFields.status: case QuoteFields.status:
return EntityStatusChip(entity: quote, showState: true); return EntityStatusChip(entity: quote, showState: true);
case QuoteFields.number: case QuoteFields.number:
return Text( return Text((quote.number ?? '').isEmpty
(quote.number ?? '').isEmpty ? localization!.pending : quote.number); ? localization!.pending
: quote.number);
case QuoteFields.client: case QuoteFields.client:
return LinkTextRelatedEntity(entity: client, relation: quote); return LinkTextRelatedEntity(entity: client, relation: quote);
case QuoteFields.date: case QuoteFields.date:
@ -130,7 +131,8 @@ class QuotePresenter extends EntityPresenter {
case QuoteFields.clientPostalCode: case QuoteFields.clientPostalCode:
return Text(client!.postalCode); return Text(client!.postalCode);
case QuoteFields.clientCountry: case QuoteFields.clientCountry:
return Text(state.staticState.countryMap[client!.countryId]?.name ?? ''); return Text(
state.staticState.countryMap[client!.countryId]?.name ?? '');
case QuoteFields.contactName: case QuoteFields.contactName:
case QuoteFields.contactEmail: case QuoteFields.contactEmail:
final contact = final contact =

View File

@ -104,8 +104,8 @@ class RecurringExpensePresenter extends EntityPresenter {
case RecurringExpenseFields.shouldBeInvoiced: case RecurringExpenseFields.shouldBeInvoiced:
return Text(expense!.shouldBeInvoiced.toString()); return Text(expense!.shouldBeInvoiced.toString());
case RecurringExpenseFields.currencyId: case RecurringExpenseFields.currencyId:
return Text(state return Text(state.staticState.currencyMap[expense!.currencyId]
.staticState.currencyMap[expense!.currencyId]?.listDisplayName ?? ?.listDisplayName ??
''); '');
case RecurringExpenseFields.category: case RecurringExpenseFields.category:
return Text(state.expenseCategoryState.map[expense!.categoryId] return Text(state.expenseCategoryState.map[expense!.categoryId]

View File

@ -222,8 +222,8 @@ class RecurringInvoiceListItem extends StatelessWidget {
(invoice!.nextSendDate.isNotEmpty (invoice!.nextSendDate.isNotEmpty
? '' ? ''
: '') + : '') +
formatDate( formatDate(invoice!.nextSendDate,
invoice!.nextSendDate, context) + context) +
(invoice!.documents.isNotEmpty (invoice!.documents.isNotEmpty
? ' 📎' ? ' 📎'
: '')) : ''))

View File

@ -301,7 +301,8 @@ class _GeneratedNumbersState extends State<GeneratedNumbers>
MapEntry<String, DropdownMenuItem<String>>( MapEntry<String, DropdownMenuItem<String>>(
id, id,
DropdownMenuItem<String>( DropdownMenuItem<String>(
child: Text(localization.lookup(frequency)!), child:
Text(localization.lookup(frequency)!),
value: id, value: id,
))) )))
.values .values

View File

@ -183,7 +183,8 @@ class _TaskSettingsState extends State<TaskSettings> {
activeColor: Theme.of(context).colorScheme.secondary, activeColor: Theme.of(context).colorScheme.secondary,
title: Text(localization.invoiceTaskItemDescription!), title: Text(localization.invoiceTaskItemDescription!),
value: company.invoiceTaskItemDescription, value: company.invoiceTaskItemDescription,
subtitle: Text(localization.invoiceTaskItemDescriptionHelp!), subtitle:
Text(localization.invoiceTaskItemDescriptionHelp!),
onChanged: (value) => viewModel.onCompanyChanged(company onChanged: (value) => viewModel.onCompanyChanged(company
.rebuild((b) => b..invoiceTaskItemDescription = value)), .rebuild((b) => b..invoiceTaskItemDescription = value)),
), ),

View File

@ -277,23 +277,23 @@ class _UserDetailsState extends State<UserDetails>
.toUpperCase(), .toUpperCase(),
textAlign: TextAlign.center, textAlign: TextAlign.center,
), ),
onPressed: onPressed: state.user!.isConnectedToGoogle ||
state.user!.isConnectedToGoogle || state.user!.isConnectedToMicrosoft state.user!.isConnectedToMicrosoft
? null ? null
: () { : () {
if (state.settingsUIState.isChanged) { if (state.settingsUIState.isChanged) {
showMessageDialog( showMessageDialog(
context: context, context: context,
message: localization.errorUnsavedChanges); message: localization.errorUnsavedChanges);
return; return;
} }
if (state.user!.isConnectedToApple) { if (state.user!.isConnectedToApple) {
viewModel.onDisconnectApplePressed(context); viewModel.onDisconnectApplePressed(context);
} else { } else {
// do nothing // do nothing
} }
}, },
), ),
); );
@ -415,7 +415,8 @@ class _UserDetailsState extends State<UserDetails>
} }
if (state.isHosted && !state.user!.phoneVerified) { if (state.isHosted && !state.user!.phoneVerified) {
final bool? phoneVerified = await showDialog<bool>( final bool? phoneVerified =
await showDialog<bool>(
context: context, context: context,
builder: (BuildContext context) => builder: (BuildContext context) =>
UserSmsVerification(), UserSmsVerification(),

View File

@ -229,7 +229,8 @@ class _BottomBar extends StatelessWidget {
)!, )!,
), ),
context, context,
clientId: state.clientState.get(task.clientId)!.id, clientId:
state.clientState.get(task.clientId)!.id,
)!; )!;
} }

View File

@ -297,7 +297,8 @@ class _KanbanTaskCardState extends State<KanbanTaskCard> {
startLabel, startLabel,
] ]
.map((value) => PopupMenuItem<String>( .map((value) => PopupMenuItem<String>(
child: Text(localization.lookup(value)!), child:
Text(localization.lookup(value)!),
value: value, value: value,
)) ))
.toList(); .toList();

View File

@ -238,7 +238,8 @@ class KanbanViewState extends State<KanbanView> {
_tasks![status.id]!.indexOf(task.id)) && _tasks![status.id]!.indexOf(task.id)) &&
task.statusId == statusId, task.statusId == statusId,
onSavePressed: (completer, description) { onSavePressed: (completer, description) {
final statusOrder = _tasks![status.id]!.indexOf(task.id); final statusOrder =
_tasks![status.id]!.indexOf(task.id);
widget.viewModel.onSaveTaskPressed( widget.viewModel.onSaveTaskPressed(
completer, completer,
task.id, task.id,

View File

@ -48,7 +48,8 @@ class TaskListItem extends StatelessWidget {
final taskUIState = uiState.taskUIState; final taskUIState = uiState.taskUIState;
final client = state.clientState.get(task!.clientId)!; final client = state.clientState.get(task!.clientId)!;
final filterMatch = filter != null && filter!.isNotEmpty final filterMatch = filter != null && filter!.isNotEmpty
? (task!.matchesFilterValue(filter) ?? client.matchesFilterValue(filter)) ? (task!.matchesFilterValue(filter) ??
client.matchesFilterValue(filter))
: null; : null;
final listUIState = taskUIState.listUIState; final listUIState = taskUIState.listUIState;
final isInMultiselect = listUIState.isInMultiselect(); final isInMultiselect = listUIState.isInMultiselect();

View File

@ -65,8 +65,9 @@ class TransactionListItem extends StatelessWidget {
builder: (BuildContext context, BoxConstraints constraints) { builder: (BuildContext context, BoxConstraints constraints) {
return constraints.maxWidth > kTableListWidthCutoff return constraints.maxWidth > kTableListWidthCutoff
? InkWell( ? InkWell(
onTap: () => onTap: () => onTap != null
onTap != null ? onTap!() : selectEntity(entity: transaction!), ? onTap!()
: selectEntity(entity: transaction!),
onLongPress: () => onLongPress != null onLongPress: () => onLongPress != null
? onLongPress!() ? onLongPress!()
: selectEntity(entity: transaction!, longPress: true), : selectEntity(entity: transaction!, longPress: true),
@ -115,7 +116,8 @@ class TransactionListItem extends StatelessWidget {
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: [ children: [
Text(transaction!.description, style: textStyle), Text(transaction!.description,
style: textStyle),
Text( Text(
state.bankAccountState state.bankAccountState
.get(transaction!.bankAccountId)! .get(transaction!.bankAccountId)!
@ -168,8 +170,9 @@ class TransactionListItem extends StatelessWidget {
), ),
) )
: ListTile( : ListTile(
onTap: () => onTap: () => onTap != null
onTap != null ? onTap!() : selectEntity(entity: transaction!), ? onTap!()
: selectEntity(entity: transaction!),
onLongPress: () => onLongPress != null onLongPress: () => onLongPress != null
? onLongPress!() ? onLongPress!()
: selectEntity(entity: transaction!, longPress: true), : selectEntity(entity: transaction!, longPress: true),

View File

@ -126,7 +126,8 @@ class TransactionPresenter extends EntityPresenter {
final vendor = state.vendorState.get(transaction!.vendorId); final vendor = state.vendorState.get(transaction!.vendorId);
return LinkTextRelatedEntity(entity: vendor, relation: transaction); return LinkTextRelatedEntity(entity: vendor, relation: transaction);
case TransactionFields.category: case TransactionFields.category:
final category = state.expenseCategoryState.get(transaction!.categoryId); final category =
state.expenseCategoryState.get(transaction!.categoryId);
return LinkTextRelatedEntity(entity: category, relation: transaction); return LinkTextRelatedEntity(entity: category, relation: transaction);
} }

View File

@ -77,7 +77,8 @@ class TransactionScreen extends StatelessWidget {
store.dispatch(FilterTransactionsByState(state)); store.dispatch(FilterTransactionsByState(state));
}, },
onSelectedStatus: (EntityStatus status, value) { onSelectedStatus: (EntityStatus status, value) {
store.dispatch(FilterTransactionsByStatus(status as TransactionStatusEntity)); store.dispatch(
FilterTransactionsByStatus(status as TransactionStatusEntity));
}, },
statuses: statuses, statuses: statuses,
), ),

View File

@ -183,7 +183,8 @@ class _TransactionRuleEditState extends State<TransactionRuleEdit> {
Text(localization.lookup(rule!.searchKey)!), Text(localization.lookup(rule!.searchKey)!),
), ),
Expanded( Expanded(
child: Text(localization.lookup(rule.operator)!), child:
Text(localization.lookup(rule.operator)!),
), ),
Expanded( Expanded(
child: Text(rule.value), child: Text(rule.value),

View File

@ -65,8 +65,9 @@ class _TransactionRuleViewState extends State<TransactionRuleView> {
: localization.disabled, : localization.disabled,
localization.vendor: localization.vendor:
state.vendorState.get(transactionRule.vendorId)!.name, state.vendorState.get(transactionRule.vendorId)!.name,
localization.category: localization.category: state.expenseCategoryState
state.expenseCategoryState.get(transactionRule.categoryId)!.name, .get(transactionRule.categoryId)!
.name,
}), }),
if (transactionRule.rules.isNotEmpty) ...[ if (transactionRule.rules.isNotEmpty) ...[
Padding( Padding(

View File

@ -45,8 +45,8 @@ class _VendorEditContactsState extends State<VendorEditContacts> {
key: Key(contact!.entityKey), key: Key(contact!.entityKey),
contact: contact, contact: contact,
isDialog: vendor.contacts.length > 1, isDialog: vendor.contacts.length > 1,
index: vendor.contacts index: vendor.contacts.indexOf(
.indexOf(vendor.contacts.firstWhere((c) => c!.id == contact.id)), vendor.contacts.firstWhere((c) => c!.id == contact.id)),
); );
}); });
} }
@ -147,8 +147,9 @@ class ContactListTile extends StatelessWidget {
style: TextStyle( style: TextStyle(
fontStyle: FontStyle.italic, fontStyle: FontStyle.italic,
)), )),
subtitle: Text( subtitle: Text(contact!.email.isNotEmpty
contact!.email.isNotEmpty ? contact!.email : contact!.phone), ? contact!.email
: contact!.phone),
trailing: Icon(Icons.navigate_next), trailing: Icon(Icons.navigate_next),
), ),
Divider( Divider(

View File

@ -198,7 +198,8 @@ class VendorListItem extends StatelessWidget {
.textTheme .textTheme
.titleSmall! .titleSmall!
.copyWith( .copyWith(
color: textColor!.withOpacity(kLighterOpacity), color:
textColor!.withOpacity(kLighterOpacity),
)) ))
: Text(vendor.number), : Text(vendor.number),
EntityStateLabel(vendor), EntityStateLabel(vendor),

View File

@ -83,7 +83,8 @@ class VendorPresenter extends EntityPresenter {
case VendorFields.postalCode: case VendorFields.postalCode:
return Text(vendor!.postalCode); return Text(vendor!.postalCode);
case VendorFields.countryId: case VendorFields.countryId:
return Text(state.staticState.countryMap[vendor!.countryId]?.name ?? ''); return Text(
state.staticState.countryMap[vendor!.countryId]?.name ?? '');
case VendorFields.privateNotes: case VendorFields.privateNotes:
return TableTooltip(message: vendor!.privateNotes); return TableTooltip(message: vendor!.privateNotes);
case VendorFields.publicNotes: case VendorFields.publicNotes:

View File

@ -97,7 +97,8 @@ class _WebhookEditState extends State<WebhookEdit> {
return EditScaffold( return EditScaffold(
entity: webhook, entity: webhook,
title: webhook.isNew ? localization!.newWebhook : localization!.editWebhook, title:
webhook.isNew ? localization!.newWebhook : localization!.editWebhook,
onCancelPressed: (context) => viewModel.onCancelPressed(context), onCancelPressed: (context) => viewModel.onCancelPressed(context),
onSavePressed: _onSavePressed, onSavePressed: _onSavePressed,
body: Form( body: Form(

View File

@ -50,8 +50,7 @@ void loadDesign({
.then((dynamic response) { .then((dynamic response) {
if ((response as Response).statusCode >= 400) { if ((response as Response).statusCode >= 400) {
showErrorDialog( showErrorDialog(
message: message: '${response.statusCode}: ${response.reasonPhrase}');
'${response.statusCode}: ${response.reasonPhrase}');
onComplete(null); onComplete(null);
} else { } else {
onComplete(response); onComplete(response);

View File

@ -588,4 +588,4 @@ class _EmptyParagraphSyntax extends md.BlockSyntax {
return md.Element('p', []); return md.Element('p', []);
} }
} }
*/ */

View File

@ -284,8 +284,8 @@ class _EditorToolbarState extends State<EditorToolbar> {
final selectionRange = final selectionRange =
SpanRange(start: selectionStart, end: selectionEnd - 1); SpanRange(start: selectionStart, end: selectionEnd - 1);
final textNode = final textNode = widget.editor!.document
widget.editor!.document.getNodeById(selection.extent.nodeId) as TextNode; .getNodeById(selection.extent.nodeId) as TextNode;
final text = textNode.text; final text = textNode.text;
final overlappingLinkAttributions = text.getAttributionSpansInRange( final overlappingLinkAttributions = text.getAttributionSpansInRange(
@ -308,8 +308,8 @@ class _EditorToolbarState extends State<EditorToolbar> {
final selectionRange = final selectionRange =
SpanRange(start: selectionStart, end: selectionEnd - 1); SpanRange(start: selectionStart, end: selectionEnd - 1);
final textNode = final textNode = widget.editor!.document
widget.editor!.document.getNodeById(selection.extent.nodeId) as TextNode; .getNodeById(selection.extent.nodeId) as TextNode;
final text = textNode.text; final text = textNode.text;
final overlappingLinkAttributions = text.getAttributionSpansInRange( final overlappingLinkAttributions = text.getAttributionSpansInRange(
@ -367,8 +367,8 @@ class _EditorToolbarState extends State<EditorToolbar> {
final selectionRange = final selectionRange =
TextRange(start: selectionStart, end: selectionEnd - 1); TextRange(start: selectionStart, end: selectionEnd - 1);
final textNode = final textNode = widget.editor!.document
widget.editor!.document.getNodeById(selection.extent.nodeId) as TextNode; .getNodeById(selection.extent.nodeId) as TextNode;
final text = textNode.text; final text = textNode.text;
final trimmedRange = _trimTextRangeWhitespace(text, selectionRange); final trimmedRange = _trimTextRangeWhitespace(text, selectionRange);
@ -383,8 +383,8 @@ class _EditorToolbarState extends State<EditorToolbar> {
_urlController!.clear(); _urlController!.clear();
setState(() { setState(() {
_showUrlField = false; _showUrlField = false;
_urlFocusNode!.unfocus( _urlFocusNode!
disposition: UnfocusDisposition.previouslyFocusedChild); .unfocus(disposition: UnfocusDisposition.previouslyFocusedChild);
widget.closeToolbar(); widget.closeToolbar();
}); });
} }