FROST Multisig settings buttons mobile and desktop

This commit is contained in:
sneurlax 2024-03-06 18:09:38 -06:00
parent f558703253
commit 809cbe6195
2 changed files with 75 additions and 1 deletions

View file

@ -22,6 +22,7 @@ import 'package:stackwallet/pages/pinpad_views/lock_screen_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/advanced_views/debug_view.dart';
import 'package:stackwallet/pages/settings_views/global_settings_view/syncing_preferences_views/syncing_preferences_view.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_ms_options_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_backup_views/wallet_backup_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_network_settings_view/wallet_network_settings_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/change_representative_view.dart';
@ -194,6 +195,21 @@ 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,

View file

@ -14,6 +14,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/frost_ms/frost_ms_options_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/change_representative_view.dart';
import 'package:stackwallet/pages/settings_views/wallet_settings_view/wallet_settings_wallet_settings/xpub_view.dart';
import 'package:stackwallet/pages_desktop_specific/addresses/desktop_wallet_addresses_view.dart';
@ -34,7 +35,8 @@ enum _WalletOptions {
changeRepresentative,
showXpub,
lelantusCoins,
sparkCoins;
sparkCoins,
frostOptions;
String get prettyName {
switch (this) {
@ -50,6 +52,8 @@ enum _WalletOptions {
return "Lelantus Coins";
case _WalletOptions.sparkCoins:
return "Spark Coins";
case _WalletOptions.frostOptions:
return "FROST settings";
}
}
}
@ -96,6 +100,9 @@ class WalletOptionsButton extends StatelessWidget {
onFiroShowSparkCoins: () async {
Navigator.of(context).pop(_WalletOptions.sparkCoins);
},
onFrostMSWalletOptionsPressed: () async {
Navigator.of(context).pop(_WalletOptions.frostOptions);
},
walletId: walletId,
);
},
@ -207,6 +214,15 @@ class WalletOptionsButton extends StatelessWidget {
),
);
break;
case _WalletOptions.frostOptions:
unawaited(
Navigator.of(context).pushNamed(
FrostMSWalletOptionsView.routeName,
arguments: walletId,
),
);
break;
}
}
},
@ -241,6 +257,7 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
required this.onChangeRepPressed,
required this.onFiroShowLelantusCoins,
required this.onFiroShowSparkCoins,
required this.onFrostMSWalletOptionsPressed,
required this.walletId,
}) : super(key: key);
@ -250,6 +267,7 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
final VoidCallback onChangeRepPressed;
final VoidCallback onFiroShowLelantusCoins;
final VoidCallback onFiroShowSparkCoins;
final VoidCallback onFrostMSWalletOptionsPressed;
final String walletId;
@override
@ -265,6 +283,9 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
final bool canChangeRep = coin == Coin.nano || coin == Coin.banano;
final bool isFrost =
coin == Coin.bitcoinFrost || coin == Coin.bitcoinFrostTestNet;
return Stack(
children: [
Positioned(
@ -429,6 +450,43 @@ class WalletOptionsPopupMenu extends ConsumerWidget {
),
),
),
if (isFrost)
const SizedBox(
height: 8,
),
if (isFrost)
TransparentButton(
onPressed: onFrostMSWalletOptionsPressed,
child: Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SvgPicture.asset(
Assets.svg.addressBookDesktop,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.textFieldActiveSearchIconLeft,
),
const SizedBox(width: 14),
Expanded(
child: Text(
_WalletOptions.frostOptions.prettyName,
style: STextStyles.desktopTextExtraExtraSmall(
context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark,
),
),
),
],
),
),
),
if (xpubEnabled)
const SizedBox(
height: 8,