diff --git a/lib/pages/home_view/sub_widgets/home_view_button_bar.dart b/lib/pages/home_view/sub_widgets/home_view_button_bar.dart index 65ec6a7b8..75a98dcac 100644 --- a/lib/pages/home_view/sub_widgets/home_view_button_bar.dart +++ b/lib/pages/home_view/sub_widgets/home_view_button_bar.dart @@ -44,8 +44,10 @@ class _HomeViewButtonBarState extends ConsumerState { @override Widget build(BuildContext context) { - //todo: check if print needed - // debugPrint("BUILD: HomeViewButtonBar"); + final prefs = ref.watch(prefsChangeNotifierProvider); + + final showExchange = prefs.showExchange; + final selectedIndex = ref.watch(homeViewPageIndexStateProvider.state).state; return Row( mainAxisAlignment: MainAxisAlignment.spaceEvenly, @@ -88,11 +90,11 @@ class _HomeViewButtonBarState extends ConsumerState { ), ), ), - if (AppConfig.hasFeature(AppFeature.swap)) + if (AppConfig.hasFeature(AppFeature.swap) && showExchange) const SizedBox( width: 8, ), - if (AppConfig.hasFeature(AppFeature.swap)) + if (AppConfig.hasFeature(AppFeature.swap) && showExchange) Expanded( child: TextButton( style: selectedIndex == 1 @@ -139,11 +141,11 @@ class _HomeViewButtonBarState extends ConsumerState { ), ), ), - if (AppConfig.hasFeature(AppFeature.buy)) + if (AppConfig.hasFeature(AppFeature.buy) && showExchange) const SizedBox( width: 8, ), - if (AppConfig.hasFeature(AppFeature.buy)) + if (AppConfig.hasFeature(AppFeature.buy) && showExchange) Expanded( child: TextButton( style: selectedIndex == 2 diff --git a/lib/pages/token_view/sub_widgets/token_summary.dart b/lib/pages/token_view/sub_widgets/token_summary.dart index 442721b54..41a386203 100644 --- a/lib/pages/token_view/sub_widgets/token_summary.dart +++ b/lib/pages/token_view/sub_widgets/token_summary.dart @@ -218,6 +218,9 @@ class TokenWalletOptions extends ConsumerWidget { @override Widget build(BuildContext context, WidgetRef ref) { + final prefs = ref.watch(prefsChangeNotifierProvider); + final showExchange = prefs.showExchange; + return Row( mainAxisAlignment: MainAxisAlignment.center, children: [ @@ -251,11 +254,11 @@ class TokenWalletOptions extends ConsumerWidget { subLabel: "Send", iconAssetPathSVG: Assets.svg.arrowUpRight, ), - if (AppConfig.hasFeature(AppFeature.swap)) + if (AppConfig.hasFeature(AppFeature.swap) && showExchange) const SizedBox( width: 16, ), - if (AppConfig.hasFeature(AppFeature.swap)) + if (AppConfig.hasFeature(AppFeature.swap) && showExchange) TokenOptionsButton( onPressed: () => _onExchangePressed(context), subLabel: "Swap", @@ -265,11 +268,11 @@ class TokenWalletOptions extends ConsumerWidget { ), ), ), - if (AppConfig.hasFeature(AppFeature.buy)) + if (AppConfig.hasFeature(AppFeature.buy) && showExchange) const SizedBox( width: 16, ), - if (AppConfig.hasFeature(AppFeature.buy)) + if (AppConfig.hasFeature(AppFeature.buy) && showExchange) TokenOptionsButton( onPressed: () => _onBuyPressed(context), subLabel: "Buy", diff --git a/lib/pages/wallet_view/wallet_view.dart b/lib/pages/wallet_view/wallet_view.dart index ea9ca50e4..34c549beb 100644 --- a/lib/pages/wallet_view/wallet_view.dart +++ b/lib/pages/wallet_view/wallet_view.dart @@ -518,6 +518,9 @@ class _WalletViewState extends ConsumerState { final coin = ref.watch(pWalletCoin(walletId)); + final prefs = ref.watch(prefsChangeNotifierProvider); + final showExchange = prefs.showExchange; + return ConditionalParent( condition: _rescanningOnOpen, builder: (child) { @@ -1053,7 +1056,8 @@ class _WalletViewState extends ConsumerState { ), if (Constants.enableExchange && ref.watch(pWalletCoin(walletId)) is! FrostCurrency && - AppConfig.hasFeature(AppFeature.swap)) + AppConfig.hasFeature(AppFeature.swap) && + showExchange) WalletNavigationBarItemData( label: "Swap", icon: const ExchangeNavIcon(), @@ -1061,7 +1065,8 @@ class _WalletViewState extends ConsumerState { ), if (Constants.enableExchange && ref.watch(pWalletCoin(walletId)) is! FrostCurrency && - AppConfig.hasFeature(AppFeature.buy)) + AppConfig.hasFeature(AppFeature.buy) && + showExchange) WalletNavigationBarItemData( label: "Buy", icon: const BuyNavIcon(), diff --git a/lib/pages_desktop_specific/desktop_menu.dart b/lib/pages_desktop_specific/desktop_menu.dart index 80bf41e78..73c383df0 100644 --- a/lib/pages_desktop_specific/desktop_menu.dart +++ b/lib/pages_desktop_specific/desktop_menu.dart @@ -186,7 +186,7 @@ class _DesktopMenuState extends ConsumerState { crossAxisAlignment: CrossAxisAlignment.stretch, children: [ DesktopMenuItem( - key: ValueKey('myStack'), + key: const ValueKey('myStack'), duration: duration, icon: const DesktopMyStackIcon(), label: "My ${AppConfig.prefix}", @@ -200,7 +200,7 @@ class _DesktopMenuState extends ConsumerState { height: 2, ), DesktopMenuItem( - key: ValueKey('swap'), + key: const ValueKey('swap'), duration: duration, icon: const DesktopExchangeIcon(), label: "Swap", @@ -215,7 +215,7 @@ class _DesktopMenuState extends ConsumerState { height: 2, ), DesktopMenuItem( - key: ValueKey('buy'), + key: const ValueKey('buy'), duration: duration, icon: const DesktopBuyIcon(), label: "Buy crypto", @@ -228,7 +228,7 @@ class _DesktopMenuState extends ConsumerState { height: 2, ), DesktopMenuItem( - key: ValueKey('notifications'), + key: const ValueKey('notifications'), duration: duration, icon: const DesktopNotificationsIcon(), label: "Notifications", @@ -240,7 +240,7 @@ class _DesktopMenuState extends ConsumerState { height: 2, ), DesktopMenuItem( - key: ValueKey('addressBook'), + key: const ValueKey('addressBook'), duration: duration, icon: const DesktopAddressBookIcon(), label: "Address Book", @@ -252,7 +252,7 @@ class _DesktopMenuState extends ConsumerState { height: 2, ), DesktopMenuItem( - key: ValueKey('settings'), + key: const ValueKey('settings'), duration: duration, icon: const DesktopSettingsIcon(), label: "Settings", @@ -264,7 +264,7 @@ class _DesktopMenuState extends ConsumerState { height: 2, ), DesktopMenuItem( - key: ValueKey('support'), + key: const ValueKey('support'), duration: duration, icon: const DesktopSupportIcon(), label: "Support", @@ -276,7 +276,7 @@ class _DesktopMenuState extends ConsumerState { height: 2, ), DesktopMenuItem( - key: ValueKey('about'), + key: const ValueKey('about'), duration: duration, icon: const DesktopAboutIcon(), label: "About", @@ -287,7 +287,7 @@ class _DesktopMenuState extends ConsumerState { const Spacer(), if (!Platform.isIOS) DesktopMenuItem( - key: ValueKey('exit'), + key: const ValueKey('exit'), duration: duration, labelLength: 123, icon: const DesktopExitIcon(), diff --git a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart index 0691cc9de..a7ee786e6 100644 --- a/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart +++ b/lib/pages_desktop_specific/my_stack_view/wallet_view/sub_widgets/desktop_wallet_features.dart @@ -353,6 +353,9 @@ class _DesktopWalletFeaturesState extends ConsumerState { final wallet = ref.watch(pWallets).getWallet(widget.walletId); final coin = wallet.info.coin; + final prefs = ref.watch(prefsChangeNotifierProvider); + final showExchange = prefs.showExchange; + final showMore = wallet is PaynymInterface || (wallet is CoinControlInterface && ref.watch( @@ -368,7 +371,9 @@ class _DesktopWalletFeaturesState extends ConsumerState { return Row( children: [ - if (Constants.enableExchange && AppConfig.hasFeature(AppFeature.swap)) + if (Constants.enableExchange && + AppConfig.hasFeature(AppFeature.swap) && + showExchange) SecondaryButton( label: "Swap", width: buttonWidth, @@ -383,11 +388,15 @@ class _DesktopWalletFeaturesState extends ConsumerState { ), onPressed: () => _onSwapPressed(), ), - if (Constants.enableExchange && AppConfig.hasFeature(AppFeature.buy)) + if (Constants.enableExchange && + AppConfig.hasFeature(AppFeature.buy) && + showExchange) const SizedBox( width: 16, ), - if (Constants.enableExchange && AppConfig.hasFeature(AppFeature.buy)) + if (Constants.enableExchange && + AppConfig.hasFeature(AppFeature.buy) && + showExchange) SecondaryButton( label: "Buy", width: buttonWidth,