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,41 +254,43 @@ class WalletOptionsPopupMenu extends StatelessWidget {
),
),
),
const SizedBox(
height: 8,
),
TransparentButton(
onPressed: onShowXpubPressed,
child: Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SvgPicture.asset(
Assets.svg.eye,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.textFieldActiveSearchIconLeft,
),
const SizedBox(width: 14),
Expanded(
child: Text(
_WalletOptions.showXpub.prettyName,
style: STextStyles.desktopTextExtraExtraSmall(
context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark,
if (xpubEnabled)
const SizedBox(
height: 8,
),
if (xpubEnabled)
TransparentButton(
onPressed: onShowXpubPressed,
child: Padding(
padding: const EdgeInsets.all(8),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: [
SvgPicture.asset(
Assets.svg.eye,
width: 20,
height: 20,
color: Theme.of(context)
.extension<StackColors>()!
.textFieldActiveSearchIconLeft,
),
const SizedBox(width: 14),
Expanded(
child: Text(
_WalletOptions.showXpub.prettyName,
style: STextStyles.desktopTextExtraExtraSmall(
context)
.copyWith(
color: Theme.of(context)
.extension<StackColors>()!
.textDark,
),
),
),
),
],
],
),
),
),
),
const SizedBox(
height: 8,
),