Format code

This commit is contained in:
Serhii 2023-12-14 18:41:43 +02:00
parent d0e28b58ac
commit 95a1291704
2 changed files with 54 additions and 27 deletions

View file

@ -21,7 +21,8 @@ class WarningPage extends BasePage {
final bool isPreSeedPage; final bool isPreSeedPage;
@override @override
Widget? leading(BuildContext context) => isPreSeedPage ? null : super.leading(context); Widget? leading(BuildContext context) =>
isPreSeedPage ? null : super.leading(context);
@override @override
String? get title => S.current.pre_seed_title; String? get title => S.current.pre_seed_title;
@ -36,14 +37,15 @@ class WarningPage extends BasePage {
alignment: Alignment.center, alignment: Alignment.center,
padding: EdgeInsets.all(24), padding: EdgeInsets.all(24),
child: ConstrainedBox( child: ConstrainedBox(
constraints: constraints: BoxConstraints(
BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint), maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
child: Column( child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Expanded( Expanded(
child: ConstrainedBox( child: ConstrainedBox(
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3), constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.3),
child: AspectRatio(aspectRatio: 1, child: image), child: AspectRatio(aspectRatio: 1, child: image),
), ),
), ),
@ -52,20 +54,25 @@ class WarningPage extends BasePage {
padding: EdgeInsets.all(10), padding: EdgeInsets.all(10),
child: Text( child: Text(
isPreSeedPage isPreSeedPage
? S.of(context).pre_seed_description(seedPhraseLength.toString()) ? S.of(context).pre_seed_description(
seedPhraseLength.toString())
: S.of(context).setup_warning_2fa_text, : S.of(context).setup_warning_2fa_text,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
height: 1.7, height: 1.7,
fontSize: 14, fontSize: 14,
fontWeight: FontWeight.normal, fontWeight: FontWeight.normal,
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor)), color: Theme.of(context)
.extension<CakeTextTheme>()!
.secondaryTextColor)),
), ),
), ),
PrimaryButton( PrimaryButton(
onPressed: () => isPreSeedPage onPressed: () => isPreSeedPage
? Navigator.of(context).popAndPushNamed(Routes.seed, arguments: true) ? Navigator.of(context)
: Navigator.of(context).popAndPushNamed(Routes.setup_2faPage), .popAndPushNamed(Routes.seed, arguments: true)
: Navigator.of(context)
.popAndPushNamed(Routes.setup_2faPage),
text: isPreSeedPage text: isPreSeedPage
? S.of(context).pre_seed_button_text ? S.of(context).pre_seed_button_text
: S.of(context).understand, : S.of(context).understand,

View file

@ -26,7 +26,9 @@ class Setup2FAQRPage extends BasePage {
@override @override
Widget body(BuildContext context) { Widget body(BuildContext context) {
final copyImage = Image.asset('assets/images/copy_content.png', final copyImage = Image.asset('assets/images/copy_content.png',
height: 16, width: 16, color: Theme.of(context).extension<CakeTextTheme>()!.titleColor); height: 16,
width: 16,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor);
final cake2FAHowToUseUrl = Uri.parse( final cake2FAHowToUseUrl = Uri.parse(
'https://guides.cakewallet.com/docs/advanced-features/authentication/#enabling-cake-2fa'); 'https://guides.cakewallet.com/docs/advanced-features/authentication/#enabling-cake-2fa');
return Padding( return Padding(
@ -45,7 +47,8 @@ class Setup2FAQRPage extends BasePage {
), ),
SizedBox(height: 10), SizedBox(height: 10),
ConstrainedBox( ConstrainedBox(
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.4), constraints: BoxConstraints(
maxHeight: MediaQuery.of(context).size.height * 0.4),
child: AspectRatio( child: AspectRatio(
aspectRatio: 1.0, aspectRatio: 1.0,
child: Container( child: Container(
@ -53,14 +56,17 @@ class Setup2FAQRPage extends BasePage {
decoration: BoxDecoration( decoration: BoxDecoration(
border: Border.all( border: Border.all(
width: 3, width: 3,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor, color: Theme.of(context)
.extension<CakeTextTheme>()!
.titleColor,
), ),
), ),
child: Container( child: Container(
child: QrImage( child: QrImage(
data: setup2FAViewModel.totpVersionOneLink, data: setup2FAViewModel.totpVersionOneLink,
version: qr.QrVersions.auto, version: qr.QrVersions.auto,
foregroundColor: Theme.of(context).extension<CakeTextTheme>()!.titleColor, foregroundColor:
Theme.of(context).extension<CakeTextTheme>()!.titleColor,
backgroundColor: Colors.transparent, backgroundColor: Colors.transparent,
)), )),
), ),
@ -90,7 +96,9 @@ class Setup2FAQRPage extends BasePage {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor, color: Theme.of(context)
.extension<CakeTextTheme>()!
.secondaryTextColor,
height: 1.8333, height: 1.8333,
), ),
), ),
@ -99,7 +107,9 @@ class Setup2FAQRPage extends BasePage {
'${setup2FAViewModel.totpSecretKey}', '${setup2FAViewModel.totpSecretKey}',
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor), color: Theme.of(context)
.extension<CakeTextTheme>()!
.titleColor),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
@ -112,8 +122,8 @@ class Setup2FAQRPage extends BasePage {
height: 32, height: 32,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
ClipboardUtil.setSensitiveDataToClipboard( ClipboardUtil.setSensitiveDataToClipboard(ClipboardData(
ClipboardData(text: '${setup2FAViewModel.totpSecretKey}')); text: '${setup2FAViewModel.totpSecretKey}'));
showBar<void>(context, S.of(context).copied_to_clipboard); showBar<void>(context, S.of(context).copied_to_clipboard);
}, },
child: Container( child: Container(
@ -140,7 +150,9 @@ class Setup2FAQRPage extends BasePage {
style: TextStyle( style: TextStyle(
fontSize: 12, fontSize: 12,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor, color: Theme.of(context)
.extension<CakeTextTheme>()!
.secondaryTextColor,
height: 1.8333, height: 1.8333,
), ),
), ),
@ -149,7 +161,9 @@ class Setup2FAQRPage extends BasePage {
'${setup2FAViewModel.totpVersionOneLink}', '${setup2FAViewModel.totpVersionOneLink}',
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor), color: Theme.of(context)
.extension<CakeTextTheme>()!
.titleColor),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
), ),
@ -162,8 +176,8 @@ class Setup2FAQRPage extends BasePage {
height: 32, height: 32,
child: InkWell( child: InkWell(
onTap: () { onTap: () {
ClipboardUtil.setSensitiveDataToClipboard( ClipboardUtil.setSensitiveDataToClipboard(ClipboardData(
ClipboardData(text: '${setup2FAViewModel.totpVersionOneLink}')); text: '${setup2FAViewModel.totpVersionOneLink}'));
showBar<void>(context, S.of(context).copied_to_clipboard); showBar<void>(context, S.of(context).copied_to_clipboard);
}, },
child: Container( child: Container(
@ -187,18 +201,24 @@ class Setup2FAQRPage extends BasePage {
decoration: TextDecoration.underline, decoration: TextDecoration.underline,
fontSize: 16, fontSize: 16,
fontWeight: FontWeight.w500, fontWeight: FontWeight.w500,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor)), color: Theme.of(context)
.extension<CakeTextTheme>()!
.titleColor)),
Icon(Icons.info_outline, Icon(Icons.info_outline,
size: 20, color: Theme.of(context).extension<CakeTextTheme>()!.titleColor) size: 20,
color: Theme.of(context)
.extension<CakeTextTheme>()!
.titleColor)
], ],
)), )),
Spacer(flex: 5), Spacer(flex: 5),
PrimaryButton( PrimaryButton(
onPressed: () { onPressed: () {
Navigator.of(context).pushReplacementNamed(Routes.totpAuthCodePage, Navigator.of(context)
arguments: TotpAuthArgumentsModel( .pushReplacementNamed(Routes.totpAuthCodePage,
isForSetup: true, arguments: TotpAuthArgumentsModel(
)); isForSetup: true,
));
}, },
text: S.current.continue_text, text: S.current.continue_text,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,