mirror of
https://git.selfprivacy.org/kherel/selfprivacy.org.app.git
synced 2025-01-23 01:06:44 +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,
|
||||
progress: status.progress,
|
||||
status: status.status,
|
||||
error: status.errorMessage,
|
||||
error: status.errorMessage ?? '',
|
||||
refreshing: false,
|
||||
));
|
||||
break;
|
||||
|
@ -69,7 +69,7 @@ class BackupsCubit extends AppConfigDependendCubit<BackupsState> {
|
|||
preventActions: true,
|
||||
progress: status.progress,
|
||||
status: status.status,
|
||||
error: status.errorMessage,
|
||||
error: status.errorMessage ?? '',
|
||||
refreshTimer: Duration(seconds: 5),
|
||||
refreshing: false,
|
||||
));
|
||||
|
|
|
@ -41,7 +41,7 @@ class BackupStatus {
|
|||
final BackupStatusEnum status;
|
||||
final double progress;
|
||||
@JsonKey(name: 'error_message')
|
||||
final String errorMessage;
|
||||
final String? errorMessage;
|
||||
|
||||
factory BackupStatus.fromJson(Map<String, dynamic> json) =>
|
||||
_$BackupStatusFromJson(json);
|
||||
|
|
|
@ -17,7 +17,7 @@ BackupStatus _$BackupStatusFromJson(Map<String, dynamic> json) {
|
|||
return BackupStatus(
|
||||
status: _$enumDecode(_$BackupStatusEnumEnumMap, json['status']),
|
||||
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: [
|
||||
if (backupStatus == BackupStatusEnum.initialized)
|
||||
ListTile(
|
||||
onTap: preventActions
|
||||
? null
|
||||
: () async {
|
||||
await context
|
||||
.read<BackupsCubit>()
|
||||
.createBackup();
|
||||
},
|
||||
leading: Icon(
|
||||
Icons.add_circle_outline_rounded,
|
||||
color: BrandColors.textColor1,
|
||||
|
|
Loading…
Reference in a new issue