mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2024-11-17 01:37:54 +00:00
make recovery screen scrollable on desktop
This commit is contained in:
parent
e3c761dfb0
commit
129c46fca0
1 changed files with 154 additions and 134 deletions
|
@ -31,6 +31,7 @@ import 'package:stackwallet/utilities/text_styles.dart';
|
||||||
import 'package:stackwallet/utilities/util.dart';
|
import 'package:stackwallet/utilities/util.dart';
|
||||||
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
import 'package:stackwallet/wallets/isar/providers/wallet_info_provider.dart';
|
||||||
import 'package:stackwallet/wallets/wallet/wallet.dart';
|
import 'package:stackwallet/wallets/wallet/wallet.dart';
|
||||||
|
import 'package:stackwallet/widgets/conditional_parent.dart';
|
||||||
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
import 'package:stackwallet/widgets/custom_buttons/app_bar_icon_button.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_app_bar.dart';
|
||||||
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
import 'package:stackwallet/widgets/desktop/desktop_scaffold.dart';
|
||||||
|
@ -180,152 +181,171 @@ class _NewWalletRecoveryPhraseViewState
|
||||||
child: Padding(
|
child: Padding(
|
||||||
padding:
|
padding:
|
||||||
isDesktop ? const EdgeInsets.all(0) : const EdgeInsets.all(16),
|
isDesktop ? const EdgeInsets.all(0) : const EdgeInsets.all(16),
|
||||||
child: Column(
|
child: ConditionalParent(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
condition: Util.isDesktop,
|
||||||
children: [
|
builder: (child) => LayoutBuilder(
|
||||||
if (isDesktop)
|
builder: (context, constraints) {
|
||||||
const Spacer(
|
return SingleChildScrollView(
|
||||||
flex: 10,
|
child: ConstrainedBox(
|
||||||
),
|
constraints: BoxConstraints(
|
||||||
if (!isDesktop)
|
minHeight: constraints.maxHeight,
|
||||||
const SizedBox(
|
),
|
||||||
height: 4,
|
child: IntrinsicHeight(
|
||||||
),
|
child: child,
|
||||||
if (!isDesktop)
|
),
|
||||||
Text(
|
|
||||||
ref.watch(pWalletName(_wallet.walletId)),
|
|
||||||
textAlign: TextAlign.center,
|
|
||||||
style: STextStyles.label(context).copyWith(
|
|
||||||
fontSize: 12,
|
|
||||||
),
|
),
|
||||||
),
|
);
|
||||||
SizedBox(
|
},
|
||||||
height: isDesktop ? 24 : 4,
|
),
|
||||||
),
|
child: Column(
|
||||||
Text(
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
"Recovery Phrase",
|
children: [
|
||||||
textAlign: TextAlign.center,
|
if (isDesktop)
|
||||||
style: isDesktop
|
const Spacer(
|
||||||
? STextStyles.desktopH2(context)
|
flex: 10,
|
||||||
: STextStyles.pageTitleH1(context),
|
),
|
||||||
),
|
if (!isDesktop)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 16,
|
height: 4,
|
||||||
),
|
),
|
||||||
Container(
|
if (!isDesktop)
|
||||||
decoration: BoxDecoration(
|
Text(
|
||||||
color: isDesktop
|
ref.watch(pWalletName(_wallet.walletId)),
|
||||||
? Theme.of(context).extension<StackColors>()!.background
|
|
||||||
: Theme.of(context).extension<StackColors>()!.popupBG,
|
|
||||||
borderRadius: BorderRadius.circular(
|
|
||||||
Constants.size.circularBorderRadius),
|
|
||||||
),
|
|
||||||
child: Padding(
|
|
||||||
padding: isDesktop
|
|
||||||
? const EdgeInsets.all(0)
|
|
||||||
: const EdgeInsets.all(12),
|
|
||||||
child: Text(
|
|
||||||
"Please write down your recovery phrase in the correct order and save it to keep your funds secure. You will also be asked to verify the words on the next screen.",
|
|
||||||
textAlign: TextAlign.center,
|
textAlign: TextAlign.center,
|
||||||
style: isDesktop
|
style: STextStyles.label(context).copyWith(
|
||||||
? STextStyles.desktopSubtitleH2(context)
|
fontSize: 12,
|
||||||
: STextStyles.label(context).copyWith(
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.accentColorDark),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: isDesktop ? 21 : 8,
|
|
||||||
),
|
|
||||||
if (!isDesktop)
|
|
||||||
Expanded(
|
|
||||||
child: SingleChildScrollView(
|
|
||||||
child: MnemonicTable(
|
|
||||||
words: _mnemonic,
|
|
||||||
isDesktop: isDesktop,
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
if (isDesktop)
|
|
||||||
MnemonicTable(
|
|
||||||
words: _mnemonic,
|
|
||||||
isDesktop: isDesktop,
|
|
||||||
),
|
|
||||||
SizedBox(
|
|
||||||
height: isDesktop ? 24 : 16,
|
|
||||||
),
|
|
||||||
if (isDesktop)
|
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 70,
|
height: isDesktop ? 24 : 4,
|
||||||
child: TextButton(
|
),
|
||||||
onPressed: () async {
|
Text(
|
||||||
await _copy();
|
"Recovery Phrase",
|
||||||
},
|
textAlign: TextAlign.center,
|
||||||
child: Row(
|
style: isDesktop
|
||||||
mainAxisAlignment: MainAxisAlignment.center,
|
? STextStyles.desktopH2(context)
|
||||||
children: [
|
: STextStyles.pageTitleH1(context),
|
||||||
SvgPicture.asset(
|
|
||||||
Assets.svg.copy,
|
|
||||||
width: 20,
|
|
||||||
height: 20,
|
|
||||||
color: Theme.of(context)
|
|
||||||
.extension<StackColors>()!
|
|
||||||
.buttonTextSecondary,
|
|
||||||
),
|
|
||||||
const SizedBox(
|
|
||||||
width: 10,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
"Copy to clipboard",
|
|
||||||
style: STextStyles.desktopButtonSecondaryEnabled(
|
|
||||||
context),
|
|
||||||
)
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
if (isDesktop)
|
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 16,
|
height: 16,
|
||||||
),
|
),
|
||||||
ConstrainedBox(
|
Container(
|
||||||
constraints: BoxConstraints(
|
decoration: BoxDecoration(
|
||||||
minHeight: isDesktop ? 70 : 0,
|
color: isDesktop
|
||||||
),
|
? Theme.of(context)
|
||||||
child: TextButton(
|
.extension<StackColors>()!
|
||||||
onPressed: () async {
|
.background
|
||||||
final int next = Random().nextInt(_mnemonic.length);
|
: Theme.of(context).extension<StackColors>()!.popupBG,
|
||||||
ref
|
borderRadius: BorderRadius.circular(
|
||||||
.read(verifyMnemonicWordIndexStateProvider.state)
|
Constants.size.circularBorderRadius),
|
||||||
.update((state) => next);
|
),
|
||||||
|
child: Padding(
|
||||||
ref
|
padding: isDesktop
|
||||||
.read(verifyMnemonicCorrectWordStateProvider.state)
|
? const EdgeInsets.all(0)
|
||||||
.update((state) => _mnemonic[next]);
|
: const EdgeInsets.all(12),
|
||||||
|
child: Text(
|
||||||
unawaited(Navigator.of(context).pushNamed(
|
"Please write down your recovery phrase in the correct order and save it to keep your funds secure. You will also be asked to verify the words on the next screen.",
|
||||||
VerifyRecoveryPhraseView.routeName,
|
textAlign: TextAlign.center,
|
||||||
arguments: Tuple2(_wallet, _mnemonic),
|
style: isDesktop
|
||||||
));
|
? STextStyles.desktopSubtitleH2(context)
|
||||||
},
|
: STextStyles.label(context).copyWith(
|
||||||
style: Theme.of(context)
|
color: Theme.of(context)
|
||||||
.extension<StackColors>()!
|
.extension<StackColors>()!
|
||||||
.getPrimaryEnabledButtonStyle(context),
|
.accentColorDark),
|
||||||
child: Text(
|
),
|
||||||
"I saved my recovery phrase",
|
|
||||||
style: isDesktop
|
|
||||||
? STextStyles.desktopButtonEnabled(context)
|
|
||||||
: STextStyles.button(context),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
SizedBox(
|
||||||
if (isDesktop)
|
height: isDesktop ? 21 : 8,
|
||||||
const Spacer(
|
|
||||||
flex: 15,
|
|
||||||
),
|
),
|
||||||
],
|
if (!isDesktop)
|
||||||
|
Expanded(
|
||||||
|
child: SingleChildScrollView(
|
||||||
|
child: MnemonicTable(
|
||||||
|
words: _mnemonic,
|
||||||
|
isDesktop: isDesktop,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
MnemonicTable(
|
||||||
|
words: _mnemonic,
|
||||||
|
isDesktop: isDesktop,
|
||||||
|
),
|
||||||
|
SizedBox(
|
||||||
|
height: isDesktop ? 24 : 16,
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
SizedBox(
|
||||||
|
height: 70,
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
await _copy();
|
||||||
|
},
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
SvgPicture.asset(
|
||||||
|
Assets.svg.copy,
|
||||||
|
width: 20,
|
||||||
|
height: 20,
|
||||||
|
color: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.buttonTextSecondary,
|
||||||
|
),
|
||||||
|
const SizedBox(
|
||||||
|
width: 10,
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
"Copy to clipboard",
|
||||||
|
style: STextStyles.desktopButtonSecondaryEnabled(
|
||||||
|
context),
|
||||||
|
)
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
const SizedBox(
|
||||||
|
height: 16,
|
||||||
|
),
|
||||||
|
ConstrainedBox(
|
||||||
|
constraints: BoxConstraints(
|
||||||
|
minHeight: isDesktop ? 70 : 0,
|
||||||
|
),
|
||||||
|
child: TextButton(
|
||||||
|
onPressed: () async {
|
||||||
|
final int next = Random().nextInt(_mnemonic.length);
|
||||||
|
ref
|
||||||
|
.read(verifyMnemonicWordIndexStateProvider.state)
|
||||||
|
.update((state) => next);
|
||||||
|
|
||||||
|
ref
|
||||||
|
.read(verifyMnemonicCorrectWordStateProvider.state)
|
||||||
|
.update((state) => _mnemonic[next]);
|
||||||
|
|
||||||
|
unawaited(Navigator.of(context).pushNamed(
|
||||||
|
VerifyRecoveryPhraseView.routeName,
|
||||||
|
arguments: Tuple2(_wallet, _mnemonic),
|
||||||
|
));
|
||||||
|
},
|
||||||
|
style: Theme.of(context)
|
||||||
|
.extension<StackColors>()!
|
||||||
|
.getPrimaryEnabledButtonStyle(context),
|
||||||
|
child: Text(
|
||||||
|
"I saved my recovery phrase",
|
||||||
|
style: isDesktop
|
||||||
|
? STextStyles.desktopButtonEnabled(context)
|
||||||
|
: STextStyles.button(context),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
if (isDesktop)
|
||||||
|
const Spacer(
|
||||||
|
flex: 15,
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
Loading…
Reference in a new issue