From dbf68f2a68d831ecfe238d52bc564f537b51acbc Mon Sep 17 00:00:00 2001 From: julian Date: Thu, 28 Nov 2024 08:27:08 -0600 Subject: [PATCH] hide exchange toggle on disabled platforms --- .../advanced_settings_view.dart | 96 ++++++++++--------- .../advanced_settings/advanced_settings.dart | 76 ++++++++------- 2 files changed, 89 insertions(+), 83 deletions(-) diff --git a/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart b/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart index 308b83db7..6f04cce80 100644 --- a/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart +++ b/lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart @@ -184,54 +184,56 @@ class AdvancedSettingsView extends StatelessWidget { ), ), // showExchange pref. - const SizedBox( - height: 8, - ), - RoundedWhiteContainer( - child: Consumer( - builder: (_, ref, __) { - return RawMaterialButton( - // splashColor: Theme.of(context).extension()!.highlight, - materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - shape: RoundedRectangleBorder( - borderRadius: BorderRadius.circular( - Constants.size.circularBorderRadius, - ), - ), - onPressed: null, - child: Padding( - padding: const EdgeInsets.symmetric(vertical: 8), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Enable exchange features", - style: STextStyles.titleBold12(context), - textAlign: TextAlign.left, - ), - SizedBox( - height: 20, - width: 40, - child: DraggableSwitchButton( - isOn: ref.watch( - prefsChangeNotifierProvider.select( - (value) => value.enableExchange, - ), - ), - onValueChanged: (newValue) { - ref - .read(prefsChangeNotifierProvider) - .enableExchange = newValue; - }, - ), - ), - ], - ), - ), - ); - }, + if (Constants.enableExchange) + const SizedBox( + height: 8, + ), + if (Constants.enableExchange) + RoundedWhiteContainer( + child: Consumer( + builder: (_, ref, __) { + return RawMaterialButton( + // splashColor: Theme.of(context).extension()!.highlight, + materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular( + Constants.size.circularBorderRadius, + ), + ), + onPressed: null, + child: Padding( + padding: const EdgeInsets.symmetric(vertical: 8), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Enable exchange features", + style: STextStyles.titleBold12(context), + textAlign: TextAlign.left, + ), + SizedBox( + height: 20, + width: 40, + child: DraggableSwitchButton( + isOn: ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.enableExchange, + ), + ), + onValueChanged: (newValue) { + ref + .read(prefsChangeNotifierProvider) + .enableExchange = newValue; + }, + ), + ), + ], + ), + ), + ); + }, + ), ), - ), const SizedBox( height: 8, ), diff --git a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart index 2fbefe90b..e96a5288c 100644 --- a/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart +++ b/lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart @@ -17,6 +17,7 @@ import '../../../../pages/settings_views/global_settings_view/advanced_views/man import '../../../../providers/global/prefs_provider.dart'; import '../../../../themes/stack_colors.dart'; import '../../../../utilities/assets.dart'; +import '../../../../utilities/constants.dart'; import '../../../../utilities/text_styles.dart'; import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; import '../../../../widgets/desktop/primary_button.dart'; @@ -163,46 +164,49 @@ class _AdvancedSettings extends ConsumerState { ), ), // showExchange pref. - const Padding( - padding: EdgeInsets.all(10.0), - child: Divider( - thickness: 0.5, + if (Constants.enableExchange) + const Padding( + padding: EdgeInsets.all(10.0), + child: Divider( + thickness: 0.5, + ), ), - ), - Padding( - padding: const EdgeInsets.all(10), - child: Row( - mainAxisAlignment: MainAxisAlignment.spaceBetween, - children: [ - Text( - "Enable exchange features", - style: STextStyles.desktopTextExtraSmall(context) - .copyWith( - color: Theme.of(context) - .extension()! - .textDark, - ), - textAlign: TextAlign.left, - ), - SizedBox( - height: 20, - width: 40, - child: DraggableSwitchButton( - isOn: ref.watch( - prefsChangeNotifierProvider.select( - (value) => value.enableExchange, - ), + if (Constants.enableExchange) + Padding( + padding: const EdgeInsets.all(10), + child: Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + children: [ + Text( + "Enable exchange features", + style: + STextStyles.desktopTextExtraSmall(context) + .copyWith( + color: Theme.of(context) + .extension()! + .textDark, ), - onValueChanged: (newValue) { - ref - .read(prefsChangeNotifierProvider) - .enableExchange = newValue; - }, + textAlign: TextAlign.left, ), - ), - ], + SizedBox( + height: 20, + width: 40, + child: DraggableSwitchButton( + isOn: ref.watch( + prefsChangeNotifierProvider.select( + (value) => value.enableExchange, + ), + ), + onValueChanged: (newValue) { + ref + .read(prefsChangeNotifierProvider) + .enableExchange = newValue; + }, + ), + ), + ], + ), ), - ), const Padding( padding: EdgeInsets.all(10.0), child: Divider(