mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-12-23 20:09:23 +00:00
manual backup ok button on dialog works
This commit is contained in:
parent
bfc1603197
commit
0f3a0b18a4
1 changed files with 74 additions and 68 deletions
|
@ -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,81 +675,86 @@ 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();
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
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:
|
maxHeight: double.infinity,
|
||||||
"Backup creation succeeded")
|
maxWidth: 500,
|
||||||
: DesktopDialog(
|
child: Padding(
|
||||||
maxHeight: double.infinity,
|
padding:
|
||||||
maxWidth: 500,
|
const EdgeInsets.only(
|
||||||
child: Padding(
|
left: 32,
|
||||||
padding:
|
right: 32,
|
||||||
const EdgeInsets.only(
|
bottom: 32,
|
||||||
left: 32,
|
|
||||||
right: 32,
|
|
||||||
bottom: 32,
|
|
||||||
),
|
|
||||||
child: Column(
|
|
||||||
mainAxisSize:
|
|
||||||
MainAxisSize.min,
|
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment
|
|
||||||
.start,
|
|
||||||
children: [
|
|
||||||
const SizedBox(
|
|
||||||
height: 26),
|
|
||||||
Text(
|
|
||||||
"Stack backup saved to: \n",
|
|
||||||
style: STextStyles
|
|
||||||
.desktopH3(
|
|
||||||
context),
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
fileToSave,
|
|
||||||
style: STextStyles
|
|
||||||
.desktopTextExtraExtraSmall(
|
|
||||||
context),
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
height: 40,
|
|
||||||
),
|
|
||||||
Row(
|
|
||||||
children: [
|
|
||||||
// const Spacer(),
|
|
||||||
Expanded(
|
|
||||||
child:
|
|
||||||
PrimaryButton(
|
|
||||||
label: "Ok",
|
|
||||||
desktopMed:
|
|
||||||
true,
|
|
||||||
onPressed:
|
|
||||||
() {
|
|
||||||
// Navigator.of(
|
|
||||||
// context)
|
|
||||||
// .pop();
|
|
||||||
},
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
child: Column(
|
||||||
|
mainAxisSize:
|
||||||
|
MainAxisSize.min,
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment
|
||||||
|
.start,
|
||||||
|
children: [
|
||||||
|
const SizedBox(
|
||||||
|
height: 26),
|
||||||
|
Text(
|
||||||
|
"Stack backup saved to: \n",
|
||||||
|
style: STextStyles
|
||||||
|
.desktopH3(context),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
fileToSave,
|
||||||
|
style: STextStyles
|
||||||
|
.desktopTextExtraExtraSmall(
|
||||||
|
context),
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
height: 40,
|
||||||
|
),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
// const Spacer(),
|
||||||
|
Expanded(
|
||||||
|
child:
|
||||||
|
PrimaryButton(
|
||||||
|
label: "Ok",
|
||||||
|
desktopMed: true,
|
||||||
|
onPressed: () {
|
||||||
|
int count = 0;
|
||||||
|
Navigator.of(
|
||||||
|
context)
|
||||||
|
.popUntil((_) =>
|
||||||
|
count++ >=
|
||||||
|
2);
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
return const StackOkDialog(
|
||||||
|
title:
|
||||||
|
"Backup creation succeeded");
|
||||||
|
}
|
||||||
|
});
|
||||||
passwordController.text = "";
|
passwordController.text = "";
|
||||||
passwordRepeatController.text = "";
|
passwordRepeatController.text = "";
|
||||||
setState(() {});
|
setState(() {});
|
||||||
|
|
Loading…
Reference in a new issue