hide exchange toggle on disabled platforms

This commit is contained in:
julian 2024-11-28 08:27:08 -06:00 committed by julian-CStack
parent 1ce4bee68c
commit dbf68f2a68
2 changed files with 89 additions and 83 deletions

View file

@ -184,54 +184,56 @@ class AdvancedSettingsView extends StatelessWidget {
), ),
), ),
// showExchange pref. // showExchange pref.
const SizedBox( if (Constants.enableExchange)
height: 8, const SizedBox(
), height: 8,
RoundedWhiteContainer( ),
child: Consumer( if (Constants.enableExchange)
builder: (_, ref, __) { RoundedWhiteContainer(
return RawMaterialButton( child: Consumer(
// splashColor: Theme.of(context).extension<StackColors>()!.highlight, builder: (_, ref, __) {
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, return RawMaterialButton(
shape: RoundedRectangleBorder( // splashColor: Theme.of(context).extension<StackColors>()!.highlight,
borderRadius: BorderRadius.circular( materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
Constants.size.circularBorderRadius, shape: RoundedRectangleBorder(
), borderRadius: BorderRadius.circular(
), Constants.size.circularBorderRadius,
onPressed: null, ),
child: Padding( ),
padding: const EdgeInsets.symmetric(vertical: 8), onPressed: null,
child: Row( child: Padding(
mainAxisAlignment: MainAxisAlignment.spaceBetween, padding: const EdgeInsets.symmetric(vertical: 8),
children: [ child: Row(
Text( mainAxisAlignment: MainAxisAlignment.spaceBetween,
"Enable exchange features", children: [
style: STextStyles.titleBold12(context), Text(
textAlign: TextAlign.left, "Enable exchange features",
), style: STextStyles.titleBold12(context),
SizedBox( textAlign: TextAlign.left,
height: 20, ),
width: 40, SizedBox(
child: DraggableSwitchButton( height: 20,
isOn: ref.watch( width: 40,
prefsChangeNotifierProvider.select( child: DraggableSwitchButton(
(value) => value.enableExchange, isOn: ref.watch(
), prefsChangeNotifierProvider.select(
), (value) => value.enableExchange,
onValueChanged: (newValue) { ),
ref ),
.read(prefsChangeNotifierProvider) onValueChanged: (newValue) {
.enableExchange = newValue; ref
}, .read(prefsChangeNotifierProvider)
), .enableExchange = newValue;
), },
], ),
), ),
), ],
); ),
}, ),
);
},
),
), ),
),
const SizedBox( const SizedBox(
height: 8, height: 8,
), ),

View file

@ -17,6 +17,7 @@ import '../../../../pages/settings_views/global_settings_view/advanced_views/man
import '../../../../providers/global/prefs_provider.dart'; import '../../../../providers/global/prefs_provider.dart';
import '../../../../themes/stack_colors.dart'; import '../../../../themes/stack_colors.dart';
import '../../../../utilities/assets.dart'; import '../../../../utilities/assets.dart';
import '../../../../utilities/constants.dart';
import '../../../../utilities/text_styles.dart'; import '../../../../utilities/text_styles.dart';
import '../../../../widgets/custom_buttons/draggable_switch_button.dart'; import '../../../../widgets/custom_buttons/draggable_switch_button.dart';
import '../../../../widgets/desktop/primary_button.dart'; import '../../../../widgets/desktop/primary_button.dart';
@ -163,46 +164,49 @@ class _AdvancedSettings extends ConsumerState<AdvancedSettings> {
), ),
), ),
// showExchange pref. // showExchange pref.
const Padding( if (Constants.enableExchange)
padding: EdgeInsets.all(10.0), const Padding(
child: Divider( padding: EdgeInsets.all(10.0),
thickness: 0.5, child: Divider(
thickness: 0.5,
),
), ),
), if (Constants.enableExchange)
Padding( Padding(
padding: const EdgeInsets.all(10), padding: const EdgeInsets.all(10),
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [ children: [
Text( Text(
"Enable exchange features", "Enable exchange features",
style: STextStyles.desktopTextExtraSmall(context) style:
.copyWith( STextStyles.desktopTextExtraSmall(context)
color: Theme.of(context) .copyWith(
.extension<StackColors>()! color: Theme.of(context)
.textDark, .extension<StackColors>()!
), .textDark,
textAlign: TextAlign.left,
),
SizedBox(
height: 20,
width: 40,
child: DraggableSwitchButton(
isOn: ref.watch(
prefsChangeNotifierProvider.select(
(value) => value.enableExchange,
),
), ),
onValueChanged: (newValue) { textAlign: TextAlign.left,
ref
.read(prefsChangeNotifierProvider)
.enableExchange = newValue;
},
), ),
), SizedBox(
], height: 20,
width: 40,
child: DraggableSwitchButton(
isOn: ref.watch(
prefsChangeNotifierProvider.select(
(value) => value.enableExchange,
),
),
onValueChanged: (newValue) {
ref
.read(prefsChangeNotifierProvider)
.enableExchange = newValue;
},
),
),
],
),
), ),
),
const Padding( const Padding(
padding: EdgeInsets.all(10.0), padding: EdgeInsets.all(10.0),
child: Divider( child: Divider(