manual backup ok button on dialog works

This commit is contained in:
ryleedavis 2022-11-16 09:53:51 -07:00
parent bfc1603197
commit 0f3a0b18a4

View file

@ -654,9 +654,10 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
},
),
);
// make sure the dialog is able to be displayed for at least 1 second
await Future<void>.delayed(
const Duration(seconds: 1));
final fut = Future<void>.delayed(
const Duration(seconds: 2));
final DateTime now = DateTime.now();
final String fileToSave =
@ -674,6 +675,8 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
jsonEncode(backup),
);
await Future.wait([fut]);
if (mounted) {
// pop encryption progress dialog
if (!isDesktop) Navigator.of(context).pop();
@ -682,16 +685,14 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
await showDialog<dynamic>(
context: context,
barrierDismissible: false,
builder: (_) => Platform.isAndroid
? StackOkDialog(
builder: (context) {
if (Platform.isAndroid) {
return StackOkDialog(
title: "Backup saved to:",
message: fileToSave,
)
: !isDesktop
? const StackOkDialog(
title:
"Backup creation succeeded")
: DesktopDialog(
);
} else if (isDesktop) {
return DesktopDialog(
maxHeight: double.infinity,
maxWidth: 500,
child: Padding(
@ -713,8 +714,7 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
Text(
"Stack backup saved to: \n",
style: STextStyles
.desktopH3(
context),
.desktopH3(context),
),
Text(
fileToSave,
@ -732,13 +732,14 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
child:
PrimaryButton(
label: "Ok",
desktopMed:
true,
onPressed:
() {
// Navigator.of(
// context)
// .pop();
desktopMed: true,
onPressed: () {
int count = 0;
Navigator.of(
context)
.popUntil((_) =>
count++ >=
2);
},
),
),
@ -747,8 +748,13 @@ class _RestoreFromFileViewState extends State<CreateBackupView> {
],
),
),
),
);
} else {
return const StackOkDialog(
title:
"Backup creation succeeded");
}
});
passwordController.text = "";
passwordRepeatController.text = "";
setState(() {});