mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-23 09:16:54 +00:00
Fix error when error is null
This commit is contained in:
parent
49efd16d37
commit
35c1eea7f0
|
@ -56,7 +56,7 @@ class BackupsCubit extends AppConfigDependendCubit<BackupsState> {
|
||||||
preventActions: false,
|
preventActions: false,
|
||||||
progress: status.progress,
|
progress: status.progress,
|
||||||
status: status.status,
|
status: status.status,
|
||||||
error: status.errorMessage,
|
error: status.errorMessage ?? '',
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
));
|
));
|
||||||
break;
|
break;
|
||||||
|
@ -69,7 +69,7 @@ class BackupsCubit extends AppConfigDependendCubit<BackupsState> {
|
||||||
preventActions: true,
|
preventActions: true,
|
||||||
progress: status.progress,
|
progress: status.progress,
|
||||||
status: status.status,
|
status: status.status,
|
||||||
error: status.errorMessage,
|
error: status.errorMessage ?? '',
|
||||||
refreshTimer: Duration(seconds: 5),
|
refreshTimer: Duration(seconds: 5),
|
||||||
refreshing: false,
|
refreshing: false,
|
||||||
));
|
));
|
||||||
|
|
|
@ -41,7 +41,7 @@ class BackupStatus {
|
||||||
final BackupStatusEnum status;
|
final BackupStatusEnum status;
|
||||||
final double progress;
|
final double progress;
|
||||||
@JsonKey(name: 'error_message')
|
@JsonKey(name: 'error_message')
|
||||||
final String errorMessage;
|
final String? errorMessage;
|
||||||
|
|
||||||
factory BackupStatus.fromJson(Map<String, dynamic> json) =>
|
factory BackupStatus.fromJson(Map<String, dynamic> json) =>
|
||||||
_$BackupStatusFromJson(json);
|
_$BackupStatusFromJson(json);
|
||||||
|
|
|
@ -17,7 +17,7 @@ BackupStatus _$BackupStatusFromJson(Map<String, dynamic> json) {
|
||||||
return BackupStatus(
|
return BackupStatus(
|
||||||
status: _$enumDecode(_$BackupStatusEnumEnumMap, json['status']),
|
status: _$enumDecode(_$BackupStatusEnumEnumMap, json['status']),
|
||||||
progress: (json['progress'] as num).toDouble(),
|
progress: (json['progress'] as num).toDouble(),
|
||||||
errorMessage: json['error_message'] as String,
|
errorMessage: json['error_message'] as String?,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,6 +105,13 @@ class _BackupDetailsState extends State<BackupDetails>
|
||||||
children: [
|
children: [
|
||||||
if (backupStatus == BackupStatusEnum.initialized)
|
if (backupStatus == BackupStatusEnum.initialized)
|
||||||
ListTile(
|
ListTile(
|
||||||
|
onTap: preventActions
|
||||||
|
? null
|
||||||
|
: () async {
|
||||||
|
await context
|
||||||
|
.read<BackupsCubit>()
|
||||||
|
.createBackup();
|
||||||
|
},
|
||||||
leading: Icon(
|
leading: Icon(
|
||||||
Icons.add_circle_outline_rounded,
|
Icons.add_circle_outline_rounded,
|
||||||
color: BrandColors.textColor1,
|
color: BrandColors.textColor1,
|
||||||
|
|
Loading…
Reference in a new issue