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) {
case kGatewayStripe:
case kGatewayStripeConnect:

View File

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

View File

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

View File

@ -56,7 +56,8 @@ class TaxRateFields {
abstract class TaxRateEntity extends Object
with BaseEntity, SelectableEntity
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._(
id: BaseEntity.nextId,
isChanged: false,
@ -100,8 +101,9 @@ abstract class TaxRateEntity extends Object
switch (sortField) {
case TaxRateFields.name:
response =
taxRateA!.name.toLowerCase().compareTo(taxRateB!.name.toLowerCase());
response = taxRateA!.name
.toLowerCase()
.compareTo(taxRateB!.name.toLowerCase());
break;
case TaxRateFields.rate:
response = taxRateA!.rate.compareTo(taxRateB!.rate);

View File

@ -40,7 +40,8 @@ class WidgetData {
dateRanges = Map.fromIterable(
DateRange.values.where((value) => value != DateRange.custom),
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)
: url = json['url'],

View File

@ -21,7 +21,8 @@ class GroupRepository {
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(
'${credentials.url}/group_settings/$entityId', credentials.token);

View File

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

View File

@ -19,7 +19,8 @@ class TokenRepository {
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(
'${credentials.url}/tokens/$entityId', credentials.token);

View File

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

View File

@ -24,7 +24,9 @@ EntityUIState clientUIReducer(ClientUIState state, dynamic action) {
..forceSelected = forceSelectedReducer(state.forceSelected, action)
..tabIndex = tabIndexReducer(state.tabIndex, 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?>([
@ -79,7 +81,8 @@ final selectedIdReducer = combineReducers<String?>([
TypedReducer<String?, AddClientSuccess>((selectedId, action) {
return action.client.id;
}),
TypedReducer<String?, ShowPdfClient>((selectedId, action) => action.client!.id),
TypedReducer<String?, ShowPdfClient>(
(selectedId, action) => action.client!.id),
TypedReducer<String?, SelectCompany>(
(selectedId, action) => action.clearSelection ? '' : selectedId),
TypedReducer<String?, ClearEntityFilter>((selectedId, action) => ''),

View File

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

View File

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

View File

@ -123,7 +123,9 @@ Middleware<AppState> _showEmailCredit() {
final emailWasSent =
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);
}
}

View File

@ -65,7 +65,9 @@ List<String> filteredDesignsSelector(BuiltMap<String?, DesignEntity?> designMap,
}
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 settings = getClientSettings(state, client);
switch (entityType) {
@ -82,7 +84,9 @@ String? getDesignIdForClientByEntity(
}
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 settings = getVendorSettings(state, vendor);

View File

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

View File

@ -21,7 +21,9 @@ EntityUIState expenseCategoryUIReducer(
..selectedId = selectedIdReducer(state.selectedId, action)
..forceSelected = forceSelectedReducer(state.forceSelected, 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>?>([

View File

@ -137,7 +137,8 @@ ListUIState _addToListMultiselect(
ListUIState _removeFromListMultiselect(
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(

View File

@ -128,7 +128,9 @@ Middleware<AppState> _showEmailInvoice() {
final emailWasSent =
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);
}
}

View File

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

View File

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

View File

@ -23,7 +23,9 @@ EntityUIState projectUIReducer(ProjectUIState state, dynamic action) {
..forceSelected = forceSelectedReducer(state.forceSelected, action)
..tabIndex = tabIndexReducer(state.tabIndex, 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?>([

View File

@ -144,7 +144,9 @@ Middleware<AppState> _showEmailPurchaseOrder() {
final emailWasSent = await navigatorKey.currentState!
.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);
}
}

View File

@ -128,7 +128,9 @@ Middleware<AppState> _showEmailQuote() {
final emailWasSent =
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);
}
}

View File

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

View File

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

View File

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

View File

@ -155,7 +155,8 @@ EntityStats taskStatsForTaskStatus(
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 status = taskStatusMap[statusId]!;
return status.isActive;

View File

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

View File

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

View File

@ -36,7 +36,8 @@ Reducer<String?> selectedIdReducer = combineReducers([
TypedReducer<String?, DeleteUserSuccess>((completer, action) => ''),
TypedReducer<String?, PreviewEntity>((selectedId, action) =>
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>(
(String? selectedId, action) => action.user.id),
TypedReducer<String?, SelectCompany>(

View File

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

View File

@ -24,7 +24,9 @@ EntityUIState vendorUIReducer(VendorUIState state, dynamic action) {
..forceSelected = forceSelectedReducer(state.forceSelected, action)
..tabIndex = tabIndexReducer(state.tabIndex, 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?>([

View File

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

View File

@ -88,7 +88,9 @@ class BottomButtons extends StatelessWidget {
textAlign: TextAlign.center,
style: TextStyle(
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: const EdgeInsets.only(bottom: kTableColumnGap),
child: TextButton(
onPressed: viewModel.onResendPressed as void Function()?,
onPressed:
viewModel.onResendPressed as void Function()?,
child: Text(localization.resendEmail.toUpperCase()),
),
),
@ -91,14 +92,16 @@ class ConfirmEmail extends StatelessWidget {
Padding(
padding: const EdgeInsets.only(bottom: kTableColumnGap),
child: TextButton(
onPressed: viewModel.onRefreshPressed as void Function()?,
onPressed:
viewModel.onRefreshPressed as void Function()?,
child: Text(localization.refreshData.toUpperCase()),
),
),
Padding(
padding: const EdgeInsets.only(bottom: kTableColumnGap),
child: TextButton(
onPressed: viewModel.onLogoutPressed as void Function()?,
onPressed:
viewModel.onLogoutPressed as void Function()?,
child: Text(localization.logout.toUpperCase()),
),
),

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -113,7 +113,8 @@ class _CompanyGatewayOverview extends StatelessWidget {
final webhookUrl =
'${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) {
final Map<String, String?> fields = {};
if (companyGateway.feesAndLimitsMap.containsKey(gatewayTypeId)) {

View File

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

View File

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

View File

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

View File

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

View File

@ -97,8 +97,8 @@ class ExpensePresenter extends EntityPresenter {
case ExpenseFields.transactionReference:
return Text(expense!.transactionReference);
case ExpenseFields.currency:
return Text(state
.staticState.currencyMap[expense!.currencyId]?.listDisplayName ??
return Text(state.staticState.currencyMap[expense!.currencyId]
?.listDisplayName ??
'');
case ExpenseFields.category:
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';
class ExpenseViewDocuments extends StatelessWidget {
const ExpenseViewDocuments(
{required this.expense, required this.viewModel});
const ExpenseViewDocuments({required this.expense, required this.viewModel});
final AbstractExpenseViewVM viewModel;
final ExpenseEntity? expense;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -229,7 +229,8 @@ class _BottomBar extends StatelessWidget {
)!,
),
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,
]
.map((value) => PopupMenuItem<String>(
child: Text(localization.lookup(value)!),
child:
Text(localization.lookup(value)!),
value: value,
))
.toList();

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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