disable xpub wallet option for monero, wownero, and firo

This commit is contained in:
sneurlax 2023-04-06 11:58:10 -05:00
parent 96f62490bb
commit 4187de8c5b

View file

@ -12,6 +12,7 @@ import 'package:stackwallet/providers/providers.dart';
import 'package:stackwallet/route_generator.dart';
import 'package:stackwallet/utilities/assets.dart';
import 'package:stackwallet/utilities/constants.dart';
import 'package:stackwallet/utilities/enums/coin_enum.dart';
import 'package:stackwallet/utilities/text_styles.dart';
import 'package:stackwallet/utilities/theme/stack_colors.dart';
@ -33,10 +34,8 @@ enum _WalletOptions {
}
class WalletOptionsButton extends ConsumerStatefulWidget {
const WalletOptionsButton({
Key? key,
required this.walletId,
}) : super(key: key);
const WalletOptionsButton({Key? key, required this.walletId})
: super(key: key);
final String walletId;
@ -47,10 +46,12 @@ class WalletOptionsButton extends ConsumerStatefulWidget {
class _WalletOptionsButtonState extends ConsumerState<WalletOptionsButton> {
late final String walletId;
late final Coin coin;
@override
void initState() {
walletId = widget.walletId;
coin = ref.read(walletsChangeNotifierProvider).getManager(walletId).coin;
super.initState();
}
@ -80,6 +81,7 @@ class _WalletOptionsButtonState extends ConsumerState<WalletOptionsButton> {
onShowXpubPressed: () async {
Navigator.of(context).pop(_WalletOptions.showXpub);
},
coin: coin,
);
},
);
@ -186,14 +188,19 @@ class WalletOptionsPopupMenu extends StatelessWidget {
required this.onDeletePressed,
required this.onAddressListPressed,
required this.onShowXpubPressed,
required this.coin,
}) : super(key: key);
final VoidCallback onDeletePressed;
final VoidCallback onAddressListPressed;
final VoidCallback onShowXpubPressed;
final Coin coin;
@override
Widget build(BuildContext context) {
final bool xpubEnabled =
coin != Coin.monero && coin != Coin.epicCash && coin != Coin.wownero;
return Stack(
children: [
Positioned(
@ -247,9 +254,11 @@ class WalletOptionsPopupMenu extends StatelessWidget {
),
),
),
if (xpubEnabled)
const SizedBox(
height: 8,
),
if (xpubEnabled)
TransparentButton(
onPressed: onShowXpubPressed,
child: Padding(