mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-10 20:54:33 +00:00
finished up desktop restore from mnemonic flow
This commit is contained in:
parent
1fa65d92a8
commit
fb0908840d
4 changed files with 227 additions and 75 deletions
|
@ -4,8 +4,8 @@ import 'package:stackwallet/utilities/assets.dart';
|
|||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
|
@ -22,30 +22,7 @@ class ConfirmRecoveryDialog extends StatelessWidget {
|
|||
return DesktopDialog(
|
||||
child: Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
AppBarIconButton(
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.textFieldDefaultBG,
|
||||
size: 40,
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.x,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.textDark,
|
||||
width: 22,
|
||||
height: 22,
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
const DesktopDialogCloseButton(),
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
),
|
||||
|
|
|
@ -3,6 +3,10 @@ import 'package:flutter_svg/svg.dart';
|
|||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/primary_button.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
|
||||
class RestoreSucceededDialog extends StatelessWidget {
|
||||
|
@ -10,27 +14,82 @@ class RestoreSucceededDialog extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return StackDialog(
|
||||
title: "Wallet restored",
|
||||
message: "You can use your wallet now.",
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.checkCircle,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Theme.of(context).extension<StackColors>()!.accentColorGreen,
|
||||
),
|
||||
rightButton: TextButton(
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getSecondaryEnabledButtonColor(context),
|
||||
child: Text(
|
||||
"Ok",
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
if (Util.isDesktop) {
|
||||
return DesktopDialog(
|
||||
child: Column(
|
||||
children: [
|
||||
const DesktopDialogCloseButton(),
|
||||
const Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
SvgPicture.asset(
|
||||
Assets.svg.checkCircle,
|
||||
width: 40,
|
||||
height: 40,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.accentColorDark,
|
||||
),
|
||||
const Spacer(
|
||||
flex: 2,
|
||||
),
|
||||
Text(
|
||||
"Wallet restored",
|
||||
style: STextStyles.desktopH2(context),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Text(
|
||||
"You can use your wallet now.",
|
||||
style: STextStyles.desktopTextMedium(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textDark3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const Spacer(
|
||||
flex: 2,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 32,
|
||||
right: 32,
|
||||
bottom: 32,
|
||||
),
|
||||
child: PrimaryButton(
|
||||
width: 272.5,
|
||||
label: "OK",
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
);
|
||||
);
|
||||
} else {
|
||||
return StackDialog(
|
||||
title: "Wallet restored",
|
||||
message: "You can use your wallet now.",
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.checkCircle,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Theme.of(context).extension<StackColors>()!.accentColorGreen,
|
||||
),
|
||||
rightButton: TextButton(
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getSecondaryEnabledButtonColor(context),
|
||||
child: Text(
|
||||
"Ok",
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop();
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,10 @@ import 'package:flutter_svg/svg.dart';
|
|||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/text_styles.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/utilities/util.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog.dart';
|
||||
import 'package:stackwallet/widgets/desktop/desktop_dialog_close_button.dart';
|
||||
import 'package:stackwallet/widgets/desktop/secondary_button.dart';
|
||||
import 'package:stackwallet/widgets/stack_dialog.dart';
|
||||
|
||||
class RestoringDialog extends StatefulWidget {
|
||||
|
@ -50,37 +54,105 @@ class _RestoringDialogState extends State<RestoringDialog>
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return false;
|
||||
},
|
||||
child: StackDialog(
|
||||
title: "Restoring wallet",
|
||||
message: "This may take a while. Please do not exit this screen.",
|
||||
icon: RotationTransition(
|
||||
turns: _spinAnimation,
|
||||
child: SvgPicture.asset(Assets.svg.arrowRotate3,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.accentColorDark),
|
||||
if (Util.isDesktop) {
|
||||
return DesktopDialog(
|
||||
child: Column(
|
||||
children: [
|
||||
DesktopDialogCloseButton(
|
||||
onPressedOverride: () async {
|
||||
await onCancel.call();
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
const Spacer(
|
||||
flex: 1,
|
||||
),
|
||||
RotationTransition(
|
||||
turns: _spinAnimation,
|
||||
child: SvgPicture.asset(Assets.svg.arrowRotate3,
|
||||
width: 40,
|
||||
height: 40,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
),
|
||||
const Spacer(
|
||||
flex: 2,
|
||||
),
|
||||
Text(
|
||||
"Restoring wallet...",
|
||||
style: STextStyles.desktopH2(context),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const SizedBox(
|
||||
height: 16,
|
||||
),
|
||||
Text(
|
||||
"Restoring your wallet may take a while.\nPlease do not exit this screen.",
|
||||
style: STextStyles.desktopTextMedium(context).copyWith(
|
||||
color: Theme.of(context).extension<StackColors>()!.textDark3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
const Spacer(
|
||||
flex: 2,
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.only(
|
||||
left: 32,
|
||||
right: 32,
|
||||
bottom: 32,
|
||||
),
|
||||
child: SecondaryButton(
|
||||
label: "Cancel",
|
||||
width: 272.5,
|
||||
onPressed: () async {
|
||||
await onCancel.call();
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
rightButton: TextButton(
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getSecondaryEnabledButtonColor(context),
|
||||
child: Text(
|
||||
"Cancel",
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
);
|
||||
} else {
|
||||
return WillPopScope(
|
||||
onWillPop: () async {
|
||||
return false;
|
||||
},
|
||||
child: StackDialog(
|
||||
title: "Restoring wallet",
|
||||
message: "This may take a while. Please do not exit this screen.",
|
||||
icon: RotationTransition(
|
||||
turns: _spinAnimation,
|
||||
child: SvgPicture.asset(Assets.svg.arrowRotate3,
|
||||
width: 24,
|
||||
height: 24,
|
||||
color: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.accentColorDark),
|
||||
),
|
||||
rightButton: TextButton(
|
||||
style: Theme.of(context)
|
||||
.extension<StackColors>()!
|
||||
.getSecondaryEnabledButtonColor(context),
|
||||
child: Text(
|
||||
"Cancel",
|
||||
style: STextStyles.itemSubtitle12(context),
|
||||
),
|
||||
onPressed: () async {
|
||||
await onCancel.call();
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
onPressed: () async {
|
||||
await onCancel.call();
|
||||
if (mounted) {
|
||||
Navigator.of(context).pop();
|
||||
}
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
44
lib/widgets/desktop/desktop_dialog_close_button.dart
Normal file
44
lib/widgets/desktop/desktop_dialog_close_button.dart
Normal file
|
@ -0,0 +1,44 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/flutter_svg.dart';
|
||||
import 'package:stackwallet/utilities/assets.dart';
|
||||
import 'package:stackwallet/utilities/theme/stack_colors.dart';
|
||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||
|
||||
class DesktopDialogCloseButton extends StatelessWidget {
|
||||
const DesktopDialogCloseButton({
|
||||
Key? key,
|
||||
this.onPressedOverride,
|
||||
}) : super(key: key);
|
||||
|
||||
final VoidCallback? onPressedOverride;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(20.0),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
children: [
|
||||
AppBarIconButton(
|
||||
color:
|
||||
Theme.of(context).extension<StackColors>()!.textFieldDefaultBG,
|
||||
size: 40,
|
||||
icon: SvgPicture.asset(
|
||||
Assets.svg.x,
|
||||
color: Theme.of(context).extension<StackColors>()!.textDark,
|
||||
width: 22,
|
||||
height: 22,
|
||||
),
|
||||
onPressed: () {
|
||||
if (onPressedOverride == null) {
|
||||
Navigator.of(context).pop();
|
||||
} else {
|
||||
onPressedOverride!.call();
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue