mobile frost wallet settings screen ui update

This commit is contained in:
julian 2024-04-29 09:52:56 -06:00
parent acccce62a8
commit 10b9e5433e
5 changed files with 92 additions and 101 deletions

10
assets/svg/swap2.svg Normal file
View file

@ -0,0 +1,10 @@
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_9616_26154)">
<path d="M11.2188 3.90625H3.625C2.38236 3.90625 1.375 4.91361 1.375 6.15625M11.2188 3.90625L8.96875 1.375M11.2188 3.90625L8.96875 6.4375M2.78125 10.375L10.375 10.375C11.6176 10.375 12.625 9.36764 12.625 8.125M2.78125 10.375L5.03125 12.9062M2.78125 10.375L5.03125 7.84375" stroke="black" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
</g>
<defs>
<clipPath id="clip0_9616_26154">
<rect width="13.5" height="13.5" fill="white" transform="translate(0.25 0.25)"/>
</clipPath>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 643 B

View file

@ -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(

View file

@ -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<StackColors>()!.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),
),
],
),
),
),
);
}
}

View file

@ -195,21 +195,6 @@ class _WalletSettingsViewState extends ConsumerState<WalletSettingsView> {
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<WalletSettingsView> {
);
},
),
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,
),

View file

@ -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";