Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ class _NewWalletRecoveryPhraseViewState
super.initState();
}

Future<bool> onWillPop() async {
Future<void> onPopInvoked() async {
await delete();
return true;
if (mounted) {
Navigator.of(context).pop();
}
}

Future<void> delete() async {
Expand All @@ -104,8 +106,14 @@ class _NewWalletRecoveryPhraseViewState
@override
Widget build(BuildContext context) {
debugPrint("BUILD: $runtimeType");
return WillPopScope(
onWillPop: onWillPop,
return PopScope(
canPop: false,
onPopInvokedWithResult: (bool didPop, dynamic result) async {
if (didPop) {
return;
}
await onPopInvoked();
},
child: MasterScaffold(
isDesktop: isDesktop,
appBar: isDesktop
Expand Down Expand Up @@ -158,17 +166,17 @@ class _NewWalletRecoveryPhraseViewState
child: AppBarIconButton(
semanticsLabel:
"Copy Button. Copies The Recovery Phrase To Clipboard.",
color: Theme.of(context)
.extension<StackColors>()!
.background,
color: Theme.of(
context,
).extension<StackColors>()!.background,
shadows: const [],
icon: SvgPicture.asset(
Assets.svg.copy,
width: 24,
height: 24,
color: Theme.of(context)
.extension<StackColors>()!
.topNavIconPrimary,
color: Theme.of(
context,
).extension<StackColors>()!.topNavIconPrimary,
),
onPressed: () async {
await _copy();
Expand All @@ -182,8 +190,9 @@ class _NewWalletRecoveryPhraseViewState
color: Theme.of(context).extension<StackColors>()!.background,
width: isDesktop ? 600 : null,
child: Padding(
padding:
isDesktop ? const EdgeInsets.all(0) : const EdgeInsets.all(16),
padding: isDesktop
? const EdgeInsets.all(0)
: const EdgeInsets.all(16),
child: ConditionalParent(
condition: Util.isDesktop,
builder: (child) => LayoutBuilder(
Expand All @@ -193,51 +202,37 @@ class _NewWalletRecoveryPhraseViewState
constraints: BoxConstraints(
minHeight: constraints.maxHeight,
),
child: IntrinsicHeight(
child: child,
),
child: IntrinsicHeight(child: child),
),
);
},
),
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
if (isDesktop)
const Spacer(
flex: 10,
),
if (!isDesktop)
const SizedBox(
height: 4,
),
if (isDesktop) const Spacer(flex: 10),
if (!isDesktop) const SizedBox(height: 4),
if (!isDesktop)
Text(
ref.watch(pWalletName(_wallet.walletId)),
textAlign: TextAlign.center,
style: STextStyles.label(context).copyWith(
fontSize: 12,
),
style: STextStyles.label(context).copyWith(fontSize: 12),
),
SizedBox(
height: isDesktop ? 24 : 4,
),
SizedBox(height: isDesktop ? 24 : 4),
Text(
"Recovery Phrase",
textAlign: TextAlign.center,
style: isDesktop
? STextStyles.desktopH2(context)
: STextStyles.pageTitleH1(context),
),
const SizedBox(
height: 16,
),
const SizedBox(height: 16),
Container(
decoration: BoxDecoration(
color: isDesktop
? Theme.of(context)
.extension<StackColors>()!
.background
? Theme.of(
context,
).extension<StackColors>()!.background
: Theme.of(context).extension<StackColors>()!.popupBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
Expand All @@ -253,16 +248,14 @@ class _NewWalletRecoveryPhraseViewState
style: isDesktop
? STextStyles.desktopSubtitleH2(context)
: STextStyles.label(context).copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.accentColorDark,
color: Theme.of(
context,
).extension<StackColors>()!.accentColorDark,
),
),
),
),
SizedBox(
height: isDesktop ? 21 : 8,
),
SizedBox(height: isDesktop ? 21 : 8),
if (!isDesktop)
Expanded(
child: SingleChildScrollView(
Expand All @@ -273,13 +266,8 @@ class _NewWalletRecoveryPhraseViewState
),
),
if (isDesktop)
MnemonicTable(
words: _mnemonic,
isDesktop: isDesktop,
),
SizedBox(
height: isDesktop ? 24 : 16,
),
MnemonicTable(words: _mnemonic, isDesktop: isDesktop),
SizedBox(height: isDesktop ? 24 : 16),
if (isDesktop)
SizedBox(
height: 70,
Expand All @@ -294,13 +282,11 @@ class _NewWalletRecoveryPhraseViewState
Assets.svg.copy,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.buttonTextSecondary,
),
const SizedBox(
width: 10,
color: Theme.of(
context,
).extension<StackColors>()!.buttonTextSecondary,
),
const SizedBox(width: 10),
Text(
"Copy to clipboard",
style: STextStyles.desktopButtonSecondaryEnabled(
Expand All @@ -311,14 +297,9 @@ class _NewWalletRecoveryPhraseViewState
),
),
),
if (isDesktop)
const SizedBox(
height: 16,
),
if (isDesktop) const SizedBox(height: 16),
ConstrainedBox(
constraints: BoxConstraints(
minHeight: isDesktop ? 70 : 0,
),
constraints: BoxConstraints(minHeight: isDesktop ? 70 : 0),
child: TextButton(
onPressed: () async {
final int next = Random().nextInt(_mnemonic.length);
Expand Down Expand Up @@ -348,10 +329,7 @@ class _NewWalletRecoveryPhraseViewState
),
),
),
if (isDesktop)
const Spacer(
flex: 15,
),
if (isDesktop) const Spacer(flex: 15),
],
),
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,15 @@ class ConfirmRecoveryDialog extends StatelessWidget {
child: Column(
children: [
const DesktopDialogCloseButton(),
const SizedBox(
height: 5,
),
SvgPicture.asset(
Assets.svg.drd,
width: 99,
height: 70,
),
const SizedBox(height: 5),
SvgPicture.asset(Assets.svg.drd, width: 99, height: 70),
const Spacer(),
Text(
"Restore wallet",
style: STextStyles.desktopH2(context),
textAlign: TextAlign.center,
),
const SizedBox(
height: 16,
),
const SizedBox(height: 16),
Text(
"Restoring your wallet may take a while.\nPlease do not exit this screen once the process is started.",
style: STextStyles.desktopTextMedium(context).copyWith(
Expand All @@ -58,11 +50,7 @@ class ConfirmRecoveryDialog extends StatelessWidget {
),
const Spacer(),
Padding(
padding: const EdgeInsets.only(
left: 32,
right: 32,
bottom: 32,
),
padding: const EdgeInsets.only(left: 32, right: 32, bottom: 32),
child: Row(
children: [
Expanded(
Expand All @@ -73,9 +61,7 @@ class ConfirmRecoveryDialog extends StatelessWidget {
},
),
),
const SizedBox(
width: 16,
),
const SizedBox(width: 16),
Expanded(
child: PrimaryButton(
label: "Restore",
Expand All @@ -92,10 +78,8 @@ class ConfirmRecoveryDialog extends StatelessWidget {
),
);
} else {
return WillPopScope(
onWillPop: () async {
return true;
},
return PopScope(
canPop: true,
child: StackDialog(
title: "Are you ready?",
message:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget {

@override
Widget build(BuildContext context, WidgetRef ref) {
return WillPopScope(
onWillPop: () async {
return PopScope(
canPop: false,
onPopInvokedWithResult: (bool didPop, dynamic result) {
if (didPop) {
return;
}
final length = ref.read(mnemonicWordCountStateProvider.state).state;
Navigator.of(context).pop(length);
return false;
},
child: Container(
decoration: BoxDecoration(
Expand All @@ -49,10 +52,9 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget {
Center(
child: Container(
decoration: BoxDecoration(
color:
Theme.of(
context,
).extension<StackColors>()!.textFieldDefaultBG,
color: Theme.of(
context,
).extension<StackColors>()!.textFieldDefaultBG,
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
),
Expand All @@ -79,16 +81,16 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget {
children: [
GestureDetector(
onTap: () {
final state =
ref
.read(
mnemonicWordCountStateProvider.state,
)
.state;
final state = ref
.read(mnemonicWordCountStateProvider.state)
.state;
if (state != lengthOptions[i]) {
ref
.read(mnemonicWordCountStateProvider.state)
.state = lengthOptions[i];
.read(
mnemonicWordCountStateProvider.state,
)
.state =
lengthOptions[i];
}

Navigator.of(context).pop();
Expand All @@ -105,25 +107,24 @@ class MnemonicWordCountSelectSheet extends ConsumerWidget {
width: 20,
height: 20,
child: Radio(
activeColor:
Theme.of(context)
.extension<StackColors>()!
.radioButtonIconEnabled,
activeColor: Theme.of(context)
.extension<StackColors>()!
.radioButtonIconEnabled,
value: lengthOptions[i],
groupValue:
ref
.watch(
mnemonicWordCountStateProvider
.state,
)
.state,
groupValue: ref
.watch(
mnemonicWordCountStateProvider
.state,
)
.state,
onChanged: (x) {
ref
.read(
mnemonicWordCountStateProvider
.state,
)
.state = lengthOptions[i];
.read(
mnemonicWordCountStateProvider
.state,
)
.state =
lengthOptions[i];
Navigator.of(context).pop();
},
),
Expand Down
Loading
Loading