Skip to content

Commit

Permalink
hide exchange toggle on disabled platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-CStack committed Nov 28, 2024
1 parent 1ce4bee commit dbf68f2
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 76 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<StackColors>()!.highlight,
materialTapTargetSize: MaterialTapTargetSize.shrinkWrap,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(
Constants.size.circularBorderRadius,
if (Constants.enableExchange)
const SizedBox(
height: 8,
),
if (Constants.enableExchange)
RoundedWhiteContainer(
child: Consumer(
builder: (_, ref, __) {
return RawMaterialButton(
// splashColor: Theme.of(context).extension<StackColors>()!.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,
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;
},
),
onValueChanged: (newValue) {
ref
.read(prefsChangeNotifierProvider)
.enableExchange = newValue;
},
),
),
],
],
),
),
),
);
},
);
},
),
),
),
const SizedBox(
height: 8,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -163,46 +164,49 @@ class _AdvancedSettings extends ConsumerState<AdvancedSettings> {
),
),
// 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<StackColors>()!
.textDark,
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<StackColors>()!
.textDark,
),
textAlign: TextAlign.left,
),
textAlign: TextAlign.left,
),
SizedBox(
height: 20,
width: 40,
child: DraggableSwitchButton(
isOn: ref.watch(
prefsChangeNotifierProvider.select(
(value) => value.enableExchange,
SizedBox(
height: 20,
width: 40,
child: DraggableSwitchButton(
isOn: ref.watch(
prefsChangeNotifierProvider.select(
(value) => value.enableExchange,
),
),
onValueChanged: (newValue) {
ref
.read(prefsChangeNotifierProvider)
.enableExchange = newValue;
},
),
onValueChanged: (newValue) {
ref
.read(prefsChangeNotifierProvider)
.enableExchange = newValue;
},
),
),
],
],
),
),
),
const Padding(
padding: EdgeInsets.all(10.0),
child: Divider(
Expand Down

0 comments on commit dbf68f2

Please sign in to comment.