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