CW-703: Better Seed UI/UX (#1868)

* feat: Switch UI for seeds display

* feat: Add localization for disclaimer text

* fix: Modify color for warning on seeds screen

* Fix: Adjust UI styling for seed page

* chore: Revert podfile.lock

* Fix column colors

* Fix more colors

---------

Co-authored-by: tuxpizza <tuxsudo@tux.pizza>
This commit is contained in:
David Adegoke
2024-12-11 22:19:52 +02:00
committed by GitHub
co-authored by tuxpizza
parent 699f591113
commit 329a1fd6de
30 changed files with 196 additions and 102 deletions
+164 -102
View File
@@ -1,5 +1,5 @@
import 'package:cake_wallet/palette.dart';
import 'package:cake_wallet/themes/extensions/cake_text_theme.dart';
import 'package:cake_wallet/themes/extensions/dashboard_page_theme.dart';
import 'package:cake_wallet/themes/extensions/pin_code_theme.dart';
import 'package:cake_wallet/themes/theme_base.dart';
import 'package:cake_wallet/src/widgets/alert_with_two_actions.dart';
@@ -15,7 +15,8 @@ import 'package:cake_wallet/generated/i18n.dart';
import 'package:cake_wallet/src/widgets/primary_button.dart';
import 'package:cake_wallet/src/screens/base_page.dart';
import 'package:cake_wallet/view_model/wallet_seed_view_model.dart';
import 'package:cake_wallet/themes/extensions/transaction_trade_theme.dart';
import '../../../themes/extensions/menu_theme.dart';
class WalletSeedPage extends BasePage {
WalletSeedPage(this.walletSeedViewModel, {required this.isNewWalletCreated});
@@ -92,118 +93,179 @@ class WalletSeedPage extends BasePage {
@override
Widget body(BuildContext context) {
final image = currentTheme.type == ThemeType.dark ? imageDark : imageLight;
return WillPopScope(
onWillPop: () async => false,
child: Container(
padding: EdgeInsets.all(24),
alignment: Alignment.center,
child: ConstrainedBox(
constraints:
BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
ConstrainedBox(
constraints: BoxConstraints(maxHeight: MediaQuery.of(context).size.height * 0.3),
child: AspectRatio(aspectRatio: 1, child: image),
),
Observer(builder: (_) {
return Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Text(
key: ValueKey('wallet_seed_page_wallet_name_text_key'),
walletSeedViewModel.name,
style: TextStyle(
onWillPop: () async => false,
child: Container(
padding: EdgeInsets.symmetric(horizontal: 24, vertical: 8),
alignment: Alignment.center,
child: ConstrainedBox(
constraints:
BoxConstraints(maxWidth: ResponsiveLayoutUtilBase.kDesktopMaxWidthConstraint),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
Observer(
builder: (_) {
return Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Container(
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 8),
decoration: BoxDecoration(
color: currentTheme.type == ThemeType.dark
? Color.fromRGBO(126, 116, 59, 1)
: Color.fromRGBO(189, 169, 90, 1),
borderRadius: BorderRadius.all(Radius.circular(12)),
border: Border.all(
color: currentTheme.type == ThemeType.dark
? Color.fromRGBO(171, 171, 41, 1)
: Color.fromRGBO(125, 122, 15, 1),
width: 2.0,
)),
child: Row(
children: [
Icon(
Icons.warning_amber_rounded,
size: 64,
color: Colors.white.withOpacity(0.75),
),
SizedBox(width: 8),
Expanded(
child: Text(
S.current.cake_seeds_save_disclaimer,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.w800,
color: currentTheme.type == ThemeType.dark
? Colors.white.withOpacity(0.75)
: Colors.white.withOpacity(0.85),
),
),
),
],
),
),
SizedBox(height: 32),
Text(
key: ValueKey('wallet_seed_page_wallet_name_text_key'),
walletSeedViewModel.name,
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.w600,
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor),
),
Padding(
padding: EdgeInsets.only(top: 20, left: 16, right: 16),
child: Text(
key: ValueKey('wallet_seed_page_wallet_seed_text_key'),
walletSeedViewModel.seed,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.normal,
color:
Theme.of(context).extension<CakeTextTheme>()!.secondaryTextColor),
color: Theme.of(context).extension<CakeTextTheme>()!.titleColor,
),
),
)
],
);
}),
Column(
children: <Widget>[
isNewWalletCreated
? Padding(
padding: EdgeInsets.only(bottom: 43, left: 43, right: 43),
child: Text(
key: ValueKey(
'wallet_seed_page_wallet_seed_reminder_text_key',
),
S.of(context).seed_reminder,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 12,
fontWeight: FontWeight.normal,
color: Theme.of(context)
.extension<TransactionTradeTheme>()!
.detailsTitlesColor,
),
SizedBox(height: 24),
Expanded(
child: GridView.builder(
padding: const EdgeInsets.symmetric(horizontal: 4),
itemCount: walletSeedViewModel.seedSplit.length,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: walletSeedViewModel.columnCount,
childAspectRatio: 3.6,
mainAxisSpacing: 8.0,
crossAxisSpacing: 8.0,
),
)
: Offstage(),
Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(right: 8.0),
child: PrimaryButton(
key: ValueKey('wallet_seed_page_save_seeds_button_key'),
itemBuilder: (context, index) {
final item = walletSeedViewModel.seedSplit[index];
final numberCount = index + 1;
return Container(
padding: const EdgeInsets.symmetric(horizontal: 4),
alignment: Alignment.center,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8),
color: Theme.of(context).cardColor,
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(
width: 20,
child: Text(
numberCount.toString(),
textAlign: TextAlign.right,
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w700,
color: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor.withOpacity(0.5)
),
),
),
const SizedBox(width: 8),
Text(
'${item[0].toUpperCase()}${item.substring(1)}',
style: TextStyle(
fontSize: 14,
fontWeight: FontWeight.w700,
color: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor
),
),
],
),
);
},
),
),
],
),
);
},
),
Column(
children: <Widget>[
Row(
mainAxisSize: MainAxisSize.max,
children: <Widget>[
Flexible(
child: Container(
padding: EdgeInsets.only(right: 8.0),
child: PrimaryButton(
key: ValueKey('wallet_seed_page_save_seeds_button_key'),
onPressed: () {
ShareUtil.share(
text: walletSeedViewModel.seed,
context: context,
);
},
text: S.of(context).save,
color: Theme.of(context).cardColor,
textColor: currentTheme.type == ThemeType.dark
? Theme.of(context).extension<DashboardPageTheme>()!.textColor
: Theme.of(context).extension<CakeTextTheme>()!.buttonTextColor,
),
),
),
Flexible(
child: Container(
padding: EdgeInsets.only(left: 8.0),
child: Builder(
builder: (context) => PrimaryButton(
key: ValueKey('wallet_seed_page_copy_seeds_button_key'),
onPressed: () {
ShareUtil.share(
text: walletSeedViewModel.seed,
context: context,
ClipboardUtil.setSensitiveDataToClipboard(
ClipboardData(text: walletSeedViewModel.seed),
);
showBar<void>(context, S.of(context).copied_to_clipboard);
},
text: S.of(context).save,
color: Colors.green,
text: S.of(context).copy,
color: Theme.of(context).primaryColor,
textColor: Colors.white,
),
),
),
Flexible(
child: Container(
padding: EdgeInsets.only(left: 8.0),
child: Builder(
builder: (context) => PrimaryButton(
key: ValueKey('wallet_seed_page_copy_seeds_button_key'),
onPressed: () {
ClipboardUtil.setSensitiveDataToClipboard(
ClipboardData(text: walletSeedViewModel.seed),
);
showBar<void>(context, S.of(context).copied_to_clipboard);
},
text: S.of(context).copy,
color: Theme.of(context).extension<PinCodeTheme>()!.indicatorsColor,
textColor: Colors.white,
),
),
),
)
],
)
],
)
],
),
)
],
),
SizedBox(height: 24),
],
)
],
),
));
),
),
);
}
}