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