Skip to content

Commit dbf68f2

Browse files
committed
hide exchange toggle on disabled platforms
1 parent 1ce4bee commit dbf68f2

File tree

2 files changed

+82
-76
lines changed

2 files changed

+82
-76
lines changed

lib/pages/settings_views/global_settings_view/advanced_views/advanced_settings_view.dart

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -184,54 +184,56 @@ class AdvancedSettingsView extends StatelessWidget {
184184
),
185185
),
186186
// showExchange pref.
187-
const SizedBox(
188-
height: 8,
189-
),
190-
RoundedWhiteContainer(
191-
child: Consumer(
192-
builder: (_, ref, __) {
193-
return RawMaterialButton(
194-
// splashColor: Theme.of(context).extension<StackColors>()!.highlight,
195-
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
196-
shape: RoundedRectangleBorder(
197-
borderRadius: BorderRadius.circular(
198-
Constants.size.circularBorderRadius,
187+
if (Constants.enableExchange)
188+
const SizedBox(
189+
height: 8,
190+
),
191+
if (Constants.enableExchange)
192+
RoundedWhiteContainer(
193+
child: Consumer(
194+
builder: (_, ref, __) {
195+
return RawMaterialButton(
196+
// splashColor: Theme.of(context).extension<StackColors>()!.highlight,
197+
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
198+
shape: RoundedRectangleBorder(
199+
borderRadius: BorderRadius.circular(
200+
Constants.size.circularBorderRadius,
201+
),
199202
),
200-
),
201-
onPressed: null,
202-
child: Padding(
203-
padding: const EdgeInsets.symmetric(vertical: 8),
204-
child: Row(
205-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
206-
children: [
207-
Text(
208-
"Enable exchange features",
209-
style: STextStyles.titleBold12(context),
210-
textAlign: TextAlign.left,
211-
),
212-
SizedBox(
213-
height: 20,
214-
width: 40,
215-
child: DraggableSwitchButton(
216-
isOn: ref.watch(
217-
prefsChangeNotifierProvider.select(
218-
(value) => value.enableExchange,
203+
onPressed: null,
204+
child: Padding(
205+
padding: const EdgeInsets.symmetric(vertical: 8),
206+
child: Row(
207+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
208+
children: [
209+
Text(
210+
"Enable exchange features",
211+
style: STextStyles.titleBold12(context),
212+
textAlign: TextAlign.left,
213+
),
214+
SizedBox(
215+
height: 20,
216+
width: 40,
217+
child: DraggableSwitchButton(
218+
isOn: ref.watch(
219+
prefsChangeNotifierProvider.select(
220+
(value) => value.enableExchange,
221+
),
219222
),
223+
onValueChanged: (newValue) {
224+
ref
225+
.read(prefsChangeNotifierProvider)
226+
.enableExchange = newValue;
227+
},
220228
),
221-
onValueChanged: (newValue) {
222-
ref
223-
.read(prefsChangeNotifierProvider)
224-
.enableExchange = newValue;
225-
},
226229
),
227-
),
228-
],
230+
],
231+
),
229232
),
230-
),
231-
);
232-
},
233+
);
234+
},
235+
),
233236
),
234-
),
235237
const SizedBox(
236238
height: 8,
237239
),

lib/pages_desktop_specific/settings/settings_menu/advanced_settings/advanced_settings.dart

Lines changed: 38 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import '../../../../pages/settings_views/global_settings_view/advanced_views/man
1717
import '../../../../providers/global/prefs_provider.dart';
1818
import '../../../../themes/stack_colors.dart';
1919
import '../../../../utilities/assets.dart';
20+
import '../../../../utilities/constants.dart';
2021
import '../../../../utilities/text_styles.dart';
2122
import '../../../../widgets/custom_buttons/draggable_switch_button.dart';
2223
import '../../../../widgets/desktop/primary_button.dart';
@@ -163,46 +164,49 @@ class _AdvancedSettings extends ConsumerState<AdvancedSettings> {
163164
),
164165
),
165166
// showExchange pref.
166-
const Padding(
167-
padding: EdgeInsets.all(10.0),
168-
child: Divider(
169-
thickness: 0.5,
167+
if (Constants.enableExchange)
168+
const Padding(
169+
padding: EdgeInsets.all(10.0),
170+
child: Divider(
171+
thickness: 0.5,
172+
),
170173
),
171-
),
172-
Padding(
173-
padding: const EdgeInsets.all(10),
174-
child: Row(
175-
mainAxisAlignment: MainAxisAlignment.spaceBetween,
176-
children: [
177-
Text(
178-
"Enable exchange features",
179-
style: STextStyles.desktopTextExtraSmall(context)
180-
.copyWith(
181-
color: Theme.of(context)
182-
.extension<StackColors>()!
183-
.textDark,
174+
if (Constants.enableExchange)
175+
Padding(
176+
padding: const EdgeInsets.all(10),
177+
child: Row(
178+
mainAxisAlignment: MainAxisAlignment.spaceBetween,
179+
children: [
180+
Text(
181+
"Enable exchange features",
182+
style:
183+
STextStyles.desktopTextExtraSmall(context)
184+
.copyWith(
185+
color: Theme.of(context)
186+
.extension<StackColors>()!
187+
.textDark,
188+
),
189+
textAlign: TextAlign.left,
184190
),
185-
textAlign: TextAlign.left,
186-
),
187-
SizedBox(
188-
height: 20,
189-
width: 40,
190-
child: DraggableSwitchButton(
191-
isOn: ref.watch(
192-
prefsChangeNotifierProvider.select(
193-
(value) => value.enableExchange,
191+
SizedBox(
192+
height: 20,
193+
width: 40,
194+
child: DraggableSwitchButton(
195+
isOn: ref.watch(
196+
prefsChangeNotifierProvider.select(
197+
(value) => value.enableExchange,
198+
),
194199
),
200+
onValueChanged: (newValue) {
201+
ref
202+
.read(prefsChangeNotifierProvider)
203+
.enableExchange = newValue;
204+
},
195205
),
196-
onValueChanged: (newValue) {
197-
ref
198-
.read(prefsChangeNotifierProvider)
199-
.enableExchange = newValue;
200-
},
201206
),
202-
),
203-
],
207+
],
208+
),
204209
),
205-
),
206210
const Padding(
207211
padding: EdgeInsets.all(10.0),
208212
child: Divider(

0 commit comments

Comments
 (0)