From a080e65ee5ad70abfd33f4a9d39c322cc4a120f7 Mon Sep 17 00:00:00 2001 From: sneurlax Date: Tue, 2 Jul 2024 19:09:07 -0500 Subject: [PATCH] hide exchange menu items contextually WHY doesn't this work tho? --- lib/pages_desktop_specific/desktop_menu.dart | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lib/pages_desktop_specific/desktop_menu.dart b/lib/pages_desktop_specific/desktop_menu.dart index 81b99fd8f..bdb95cf71 100644 --- a/lib/pages_desktop_specific/desktop_menu.dart +++ b/lib/pages_desktop_specific/desktop_menu.dart @@ -17,6 +17,7 @@ import 'package:flutter_svg/flutter_svg.dart'; import '../app_config.dart'; import '../providers/desktop/current_desktop_menu_item.dart'; +import '../providers/providers.dart'; import '../themes/stack_colors.dart'; import '../utilities/assets.dart'; import '../utilities/text_styles.dart'; @@ -114,6 +115,10 @@ class _DesktopMenuState extends ConsumerState { @override Widget build(BuildContext context) { + final prefs = ref.watch(prefsChangeNotifierProvider); + + final showExchange = prefs.showExchange; + return Material( color: Theme.of(context).extension()!.popupBG, child: AnimatedContainer( @@ -188,11 +193,9 @@ class _DesktopMenuState extends ConsumerState { onChanged: updateSelectedMenuItem, controller: controllers[0], ), - if (AppConfig.hasFeature(AppFeature.swap)) - const SizedBox( - height: 2, - ), - if (AppConfig.hasFeature(AppFeature.swap)) + if (AppConfig.hasFeature(AppFeature.swap) && showExchange) + const SizedBox(height: 2), + if (AppConfig.hasFeature(AppFeature.swap) && showExchange) DesktopMenuItem( duration: duration, icon: const DesktopExchangeIcon(), @@ -201,11 +204,9 @@ class _DesktopMenuState extends ConsumerState { onChanged: updateSelectedMenuItem, controller: controllers[1], ), - if (AppConfig.hasFeature(AppFeature.buy)) - const SizedBox( - height: 2, - ), - if (AppConfig.hasFeature(AppFeature.buy)) + if (AppConfig.hasFeature(AppFeature.buy) && showExchange) + const SizedBox(height: 2), + if (AppConfig.hasFeature(AppFeature.buy) && showExchange) DesktopMenuItem( duration: duration, icon: const DesktopBuyIcon(),