Null safety
This commit is contained in:
parent
be31e0c9da
commit
f8225112ab
|
|
@ -133,7 +133,6 @@ abstract class UserEntity extends Object
|
||||||
customValue2: '',
|
customValue2: '',
|
||||||
customValue3: '',
|
customValue3: '',
|
||||||
customValue4: '',
|
customValue4: '',
|
||||||
userCompany: userCompany,
|
|
||||||
oauthProvider: '',
|
oauthProvider: '',
|
||||||
isTwoFactorEnabled: false,
|
isTwoFactorEnabled: false,
|
||||||
hasPassword: false,
|
hasPassword: false,
|
||||||
|
|
@ -141,6 +140,7 @@ abstract class UserEntity extends Object
|
||||||
oauthUserToken: '',
|
oauthUserToken: '',
|
||||||
password: '',
|
password: '',
|
||||||
phoneVerified: false,
|
phoneVerified: false,
|
||||||
|
userCompany: userCompany ?? UserCompanyEntity(false),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -332,6 +332,7 @@ abstract class UserEntity extends Object
|
||||||
|
|
||||||
// ignore: unused_element
|
// ignore: unused_element
|
||||||
static void _initializeBuilder(UserEntityBuilder builder) => builder
|
static void _initializeBuilder(UserEntityBuilder builder) => builder
|
||||||
|
..userCompany.replace(UserCompanyEntity(false))
|
||||||
..isTwoFactorEnabled = false
|
..isTwoFactorEnabled = false
|
||||||
..hasPassword = false
|
..hasPassword = false
|
||||||
..phoneVerified = false
|
..phoneVerified = false
|
||||||
|
|
|
||||||
|
|
@ -147,10 +147,6 @@ SettingsEntity getClientSettings(AppState? state, ClientEntity? client) {
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsEntity getVendorSettings(AppState state, VendorEntity? vendor) {
|
SettingsEntity getVendorSettings(AppState state, VendorEntity? vendor) {
|
||||||
if (state == null) {
|
|
||||||
return SettingsEntity();
|
|
||||||
}
|
|
||||||
|
|
||||||
vendor ??= VendorEntity();
|
vendor ??= VendorEntity();
|
||||||
final company = state.company!;
|
final company = state.company!;
|
||||||
//final group = state.groupState.get(vendor.groupId);
|
//final group = state.groupState.get(vendor.groupId);
|
||||||
|
|
|
||||||
|
|
@ -194,16 +194,6 @@ UserCompanyEntity loadCompanySuccessReducer(
|
||||||
UserCompanyEntity? company, LoadCompanySuccess action) {
|
UserCompanyEntity? company, LoadCompanySuccess action) {
|
||||||
var userCompany = action.userCompany;
|
var userCompany = action.userCompany;
|
||||||
|
|
||||||
// Check user has a blank user settings object
|
|
||||||
if (userCompany.settings == null) {
|
|
||||||
userCompany = userCompany.rebuild((b) => b
|
|
||||||
..settings.replace(UserSettingsEntity())
|
|
||||||
..user
|
|
||||||
.userCompany
|
|
||||||
.notifications
|
|
||||||
.replace(BuiltMap<String, BuiltList<String>>()));
|
|
||||||
}
|
|
||||||
|
|
||||||
userCompany = userCompany.rebuild((b) => b.company
|
userCompany = userCompany.rebuild((b) => b.company
|
||||||
..taskStatuses.replace(<TaskStatusEntity>[])
|
..taskStatuses.replace(<TaskStatusEntity>[])
|
||||||
..taskStatusMap.replace(BuiltMap<String, TaskStatusEntity>())
|
..taskStatusMap.replace(BuiltMap<String, TaskStatusEntity>())
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,6 @@ Future<void> showEntityActionsDialog(
|
||||||
{required List<BaseEntity?> entities,
|
{required List<BaseEntity?> entities,
|
||||||
Completer? completer,
|
Completer? completer,
|
||||||
bool multiselect = false}) async {
|
bool multiselect = false}) async {
|
||||||
if (entities == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
final mainContext = navigatorKey.currentContext;
|
final mainContext = navigatorKey.currentContext;
|
||||||
final state = StoreProvider.of<AppState>(navigatorKey.currentContext!).state;
|
final state = StoreProvider.of<AppState>(navigatorKey.currentContext!).state;
|
||||||
final actions = <Widget>[];
|
final actions = <Widget>[];
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,6 @@ class EntityStatusChip extends StatelessWidget {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return SizedBox();
|
return SizedBox();
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
label = localization!.lookup(label) ?? '';
|
label = localization!.lookup(label) ?? '';
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@ class InvoiceItemListTile extends StatelessWidget {
|
||||||
SizedBox(width: 1),
|
SizedBox(width: 1),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
trailing: onTap != null ? Icon(Icons.navigate_next) : null,
|
trailing: Icon(Icons.navigate_next),
|
||||||
),
|
),
|
||||||
ListDivider(),
|
ListDivider(),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -296,7 +296,7 @@ class AppPaginatedDataTableState extends State<AppPaginatedDataTable> {
|
||||||
DataRow? row;
|
DataRow? row;
|
||||||
if (index < _rowCount || _rowCountApproximate) {
|
if (index < _rowCount || _rowCountApproximate) {
|
||||||
row = _rows.putIfAbsent(index, () => widget.source.getRow(index));
|
row = _rows.putIfAbsent(index, () => widget.source.getRow(index));
|
||||||
if (row == null && !haveProgressIndicator) {
|
if (!haveProgressIndicator) {
|
||||||
row = _getProgressIndicatorRowFor(index);
|
row = _getProgressIndicatorRowFor(index);
|
||||||
haveProgressIndicator = true;
|
haveProgressIndicator = true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,17 +60,6 @@ class EntityDataTableSource extends AppDataTableSource {
|
||||||
final listState = state.getListState(entityType);
|
final listState = state.getListState(entityType);
|
||||||
final uIState = state.getUIState(entityType);
|
final uIState = state.getUIState(entityType);
|
||||||
|
|
||||||
if (entity == null) {
|
|
||||||
return DataRow(cells: [
|
|
||||||
DataCell(SizedBox()),
|
|
||||||
...tableColumns!.map(
|
|
||||||
(field) => DataCell(
|
|
||||||
SizedBox(),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isSelected = false;
|
bool isSelected = false;
|
||||||
if (!listState.isInMultiselect() &&
|
if (!listState.isInMultiselect() &&
|
||||||
(state.prefState.isPreviewVisible || state.uiState.isEditing)) {
|
(state.prefState.isPreviewVisible || state.uiState.isEditing)) {
|
||||||
|
|
|
||||||
|
|
@ -753,8 +753,6 @@ class DashboardPanels extends StatelessWidget {
|
||||||
case DashboardSections.runningTasks:
|
case DashboardSections.runningTasks:
|
||||||
return runningTasks!;
|
return runningTasks!;
|
||||||
}
|
}
|
||||||
|
|
||||||
return SizedBox();
|
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
|
||||||
|
|
@ -95,9 +95,6 @@ class DashboardVM {
|
||||||
isLoading: state.isLoading,
|
isLoading: state.isLoading,
|
||||||
onRefreshed: (context) => _handleRefresh(context),
|
onRefreshed: (context) => _handleRefresh(context),
|
||||||
onEntityTypeChanged: (entityType) {
|
onEntityTypeChanged: (entityType) {
|
||||||
if (entityType == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
store.dispatch(UpdateDashboardEntityType(entityType: entityType));
|
store.dispatch(UpdateDashboardEntityType(entityType: entityType));
|
||||||
},
|
},
|
||||||
onSettingsChanged: (DashboardSettings settings) =>
|
onSettingsChanged: (DashboardSettings settings) =>
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ class ExpenseListItem extends StatelessWidget {
|
||||||
String subtitle = '';
|
String subtitle = '';
|
||||||
if (filterMatch != null) {
|
if (filterMatch != null) {
|
||||||
subtitle = filterMatch;
|
subtitle = filterMatch;
|
||||||
} else if (client != null || vendor != null || category != null) {
|
} else {
|
||||||
final parts = <String>[
|
final parts = <String>[
|
||||||
formatDate(expense.date, context),
|
formatDate(expense.date, context),
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue