From 10b9e5433eb5588edd3a803a1a6c5f62bc322a2f Mon Sep 17 00:00:00 2001 From: julian Date: Mon, 29 Apr 2024 09:52:56 -0600 Subject: [PATCH] mobile frost wallet settings screen ui update --- assets/svg/swap2.svg | 10 ++ .../sub_widgets/settings_list_button.dart | 8 +- .../frost_ms/frost_ms_options_view.dart | 143 ++++++++---------- .../wallet_settings_view.dart | 31 ++-- lib/utilities/assets.dart | 1 + 5 files changed, 92 insertions(+), 101 deletions(-) create mode 100644 assets/svg/swap2.svg diff --git a/assets/svg/swap2.svg b/assets/svg/swap2.svg new file mode 100644 index 000000000..1c9ce8191 --- /dev/null +++ b/assets/svg/swap2.svg @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/lib/pages/settings_views/sub_widgets/settings_list_button.dart b/lib/pages/settings_views/sub_widgets/settings_list_button.dart index 2e4c19d01..62b4a2aec 100644 --- a/lib/pages/settings_views/sub_widgets/settings_list_button.dart +++ b/lib/pages/settings_views/sub_widgets/settings_list_button.dart @@ -16,17 +16,19 @@ import 'package:stackwallet/utilities/text_styles.dart'; class SettingsListButton extends StatelessWidget { const SettingsListButton({ - Key? key, + super.key, required this.iconAssetName, required this.title, this.onPressed, this.iconSize = 20.0, - }) : super(key: key); + this.padding = const EdgeInsets.all(8.0), + }); final String iconAssetName; final String title; final VoidCallback? onPressed; final double iconSize; + final EdgeInsetsGeometry padding; @override Widget build(BuildContext context) { @@ -44,7 +46,7 @@ class SettingsListButton extends StatelessWidget { ), onPressed: onPressed, child: Padding( - padding: const EdgeInsets.all(8.0), + padding: padding, child: Row( children: [ Container( diff --git a/lib/pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart b/lib/pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart index 7fc7236a4..cfcb75a7e 100644 --- a/lib/pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart @@ -10,6 +10,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; +import 'package:stackwallet/pages/settings_views/sub_widgets/settings_list_button.dart'; import 'package:stackwallet/pages/settings_views/wallet_settings_view/frost_ms/frost_participants_view.dart'; import 'package:stackwallet/pages/settings_views/wallet_settings_view/frost_ms/resharing/involved/step_1a/begin_reshare_config_view.dart'; import 'package:stackwallet/pages/settings_views/wallet_settings_view/frost_ms/resharing/involved/step_1b/import_reshare_config_view.dart'; @@ -17,7 +18,7 @@ import 'package:stackwallet/pages_desktop_specific/my_stack_view/exit_to_my_stac import 'package:stackwallet/providers/db/main_db_provider.dart'; import 'package:stackwallet/providers/frost_wallet/frost_wallet_providers.dart'; import 'package:stackwallet/themes/stack_colors.dart'; -import 'package:stackwallet/utilities/constants.dart'; +import 'package:stackwallet/utilities/assets.dart'; import 'package:stackwallet/utilities/text_styles.dart'; import 'package:stackwallet/utilities/util.dart'; import 'package:stackwallet/wallets/isar/models/frost_wallet_info.dart'; @@ -30,14 +31,16 @@ import 'package:stackwallet/widgets/rounded_white_container.dart'; class FrostMSWalletOptionsView extends ConsumerWidget { const FrostMSWalletOptionsView({ - Key? key, + super.key, required this.walletId, - }) : super(key: key); + }); static const String routeName = "/frostMSWalletOptionsView"; final String walletId; + static const _padding = 12.0; + @override Widget build(BuildContext context, WidgetRef ref) { return ConditionalParent( @@ -83,56 +86,72 @@ class FrostMSWalletOptionsView extends ConsumerWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.stretch, children: [ - _OptionButton( - label: "Show participants", - onPressed: () { - Navigator.of(context).pushNamed( - FrostParticipantsView.routeName, - arguments: walletId, - ); - }, + RoundedWhiteContainer( + padding: EdgeInsets.zero, + child: SettingsListButton( + padding: const EdgeInsets.all(_padding), + title: "Show participants", + iconAssetName: Assets.svg.peers, + onPressed: () { + Navigator.of(context).pushNamed( + FrostParticipantsView.routeName, + arguments: walletId, + ); + }, + ), ), const SizedBox( height: 8, ), - _OptionButton( - label: "Initiate resharing", - onPressed: () { - // TODO: optimize this by creating watcher providers (similar to normal WalletInfo) - final frostInfo = ref - .read(mainDBProvider) - .isar - .frostWalletInfo - .getByWalletIdSync(walletId)!; + RoundedWhiteContainer( + padding: EdgeInsets.zero, + child: SettingsListButton( + padding: const EdgeInsets.all(_padding), + title: "Initiate resharing", + iconAssetName: Assets.svg.swap2, + onPressed: () { + // TODO: optimize this by creating watcher providers (similar to normal WalletInfo) + final frostInfo = ref + .read(mainDBProvider) + .isar + .frostWalletInfo + .getByWalletIdSync(walletId)!; - ref.read(pFrostMyName.state).state = frostInfo.myName; + ref.read(pFrostMyName.state).state = frostInfo.myName; - Navigator.of(context).pushNamed( - BeginReshareConfigView.routeName, - arguments: walletId, - ); - }, + Navigator.of(context).pushNamed( + BeginReshareConfigView.routeName, + arguments: walletId, + ); + }, + ), ), const SizedBox( height: 8, ), - _OptionButton( - label: "Import reshare config", - onPressed: () { - // TODO: optimize this by creating watcher providers (similar to normal WalletInfo) - final frostInfo = ref - .read(mainDBProvider) - .isar - .frostWalletInfo - .getByWalletIdSync(walletId)!; + RoundedWhiteContainer( + padding: EdgeInsets.zero, + child: SettingsListButton( + padding: const EdgeInsets.all(_padding), + title: "Import reshare config", + iconAssetName: Assets.svg.downloadFolder, + iconSize: 16, + onPressed: () { + // TODO: optimize this by creating watcher providers (similar to normal WalletInfo) + final frostInfo = ref + .read(mainDBProvider) + .isar + .frostWalletInfo + .getByWalletIdSync(walletId)!; - ref.read(pFrostMyName.state).state = frostInfo.myName; + ref.read(pFrostMyName.state).state = frostInfo.myName; - Navigator.of(context).pushNamed( - ImportReshareConfigView.routeName, - arguments: walletId, - ); - }, + Navigator.of(context).pushNamed( + ImportReshareConfigView.routeName, + arguments: walletId, + ); + }, + ), ), ], ), @@ -142,45 +161,3 @@ class FrostMSWalletOptionsView extends ConsumerWidget { ); } } - -class _OptionButton extends StatelessWidget { - const _OptionButton({ - super.key, - required this.label, - required this.onPressed, - }); - - final String label; - final VoidCallback onPressed; - - @override - Widget build(BuildContext context) { - return RoundedWhiteContainer( - padding: const EdgeInsets.all(0), - child: RawMaterialButton( - // splashColor: Theme.of(context).extension()!.highlight, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - onPressed: onPressed, - child: Padding( - padding: const EdgeInsets.symmetric( - horizontal: 12.0, - vertical: 20, - ), - child: Row( - children: [ - Text( - label, - style: STextStyles.titleBold12(context), - ), - ], - ), - ), - ), - ); - } -} diff --git a/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart b/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart index 04de48cb4..2eca78057 100644 --- a/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart +++ b/lib/pages/settings_views/wallet_settings_view/wallet_settings_view.dart @@ -195,21 +195,6 @@ class _WalletSettingsViewState extends ConsumerState { padding: const EdgeInsets.all(4), child: Column( children: [ - if (coin == Coin.bitcoinFrost || - coin == Coin.bitcoinFrostTestNet) - if (coin == Coin.bitcoinFrost || - coin == Coin.bitcoinFrostTestNet) - SettingsListButton( - iconAssetName: Assets.svg.addressBook2, - iconSize: 16, - title: "FROST Multisig settings", - onPressed: () { - Navigator.of(context).pushNamed( - FrostMSWalletOptionsView.routeName, - arguments: walletId, - ); - }, - ), SettingsListButton( iconAssetName: Assets.svg.addressBook, iconSize: 16, @@ -221,6 +206,22 @@ class _WalletSettingsViewState extends ConsumerState { ); }, ), + if (coin.isFrost) + const SizedBox( + height: 8, + ), + if (coin.isFrost) + SettingsListButton( + iconAssetName: Assets.svg.addressBook2, + iconSize: 16, + title: "FROST Multisig settings", + onPressed: () { + Navigator.of(context).pushNamed( + FrostMSWalletOptionsView.routeName, + arguments: walletId, + ); + }, + ), const SizedBox( height: 8, ), diff --git a/lib/utilities/assets.dart b/lib/utilities/assets.dart index ff385a44d..9213fd1b2 100644 --- a/lib/utilities/assets.dart +++ b/lib/utilities/assets.dart @@ -143,6 +143,7 @@ class _SVG { String get chevronDown => "assets/svg/chevron-down.svg"; String get chevronUp => "assets/svg/chevron-up.svg"; String get swap => "assets/svg/swap.svg"; + String get swap2 => "assets/svg/swap2.svg"; String get downloadFolder => "assets/svg/folder-down.svg"; String get lock => "assets/svg/lock-keyhole.svg"; String get lockOpen => "assets/svg/lock-open.svg";