Skip to content

Commit

Permalink
moved feature chips settings to player screen settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaphasilor committed Nov 11, 2024
1 parent 0f6e440 commit 0ab8a87
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 34 deletions.
34 changes: 0 additions & 34 deletions lib/screens/customization_settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class _CustomizationSettingsScreenState
const PlaybackSpeedControlVisibilityDropdownListTile(),
if (!Platform.isIOS) const ShowStopButtonOnMediaNotificationToggle(),
const ShowSeekControlsOnMediaNotificationToggle(),
const ShowFeatureChipsToggle(),
],
),
);
Expand Down Expand Up @@ -110,36 +109,3 @@ class ShowSeekControlsOnMediaNotificationToggle extends StatelessWidget {
);
}
}

class ShowFeatureChipsToggle extends StatelessWidget {
const ShowFeatureChipsToggle({super.key});

@override
Widget build(BuildContext context) {
return ValueListenableBuilder<Box<FinampSettings>>(
valueListenable: FinampSettingsHelper.finampSettingsListener,
builder: (context, box, child) {
bool? featureChipsEnabled =
box.get("FinampSettings")?.featureChipsConfiguration.enabled;

return SwitchListTile.adaptive(
title:
Text(AppLocalizations.of(context)!.showFeatureChipsToggleTitle),
subtitle: Text(
AppLocalizations.of(context)!.showFeatureChipsToggleSubtitle),
value: featureChipsEnabled ?? false,
onChanged: featureChipsEnabled == null
? null
: (value) {
FinampSettings finampSettingsTemp =
box.get("FinampSettings")!;
finampSettingsTemp.featureChipsConfiguration =
finampSettingsTemp.featureChipsConfiguration
.copyWith(enabled: value);
box.put("FinampSettings", finampSettingsTemp);
},
);
},
);
}
}
34 changes: 34 additions & 0 deletions lib/screens/player_settings_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class PlayerSettingsScreen extends StatelessWidget {
),
body: ListView(
children: const [
const ShowFeatureChipsToggle(),
PlayerScreenMinimumCoverPaddingEditor(),
SuppressPlayerPaddingSwitch(),
PrioritizeCoverSwitch(),
Expand Down Expand Up @@ -117,3 +118,36 @@ class PrioritizeCoverSwitch extends StatelessWidget {
);
}
}

class ShowFeatureChipsToggle extends StatelessWidget {
const ShowFeatureChipsToggle({super.key});

@override
Widget build(BuildContext context) {
return ValueListenableBuilder<Box<FinampSettings>>(
valueListenable: FinampSettingsHelper.finampSettingsListener,
builder: (context, box, child) {
bool? featureChipsEnabled =
box.get("FinampSettings")?.featureChipsConfiguration.enabled;

return SwitchListTile.adaptive(
title:
Text(AppLocalizations.of(context)!.showFeatureChipsToggleTitle),
subtitle: Text(
AppLocalizations.of(context)!.showFeatureChipsToggleSubtitle),
value: featureChipsEnabled ?? false,
onChanged: featureChipsEnabled == null
? null
: (value) {
FinampSettings finampSettingsTemp =
box.get("FinampSettings")!;
finampSettingsTemp.featureChipsConfiguration =
finampSettingsTemp.featureChipsConfiguration
.copyWith(enabled: value);
box.put("FinampSettings", finampSettingsTemp);
},
);
},
);
}
}

0 comments on commit 0ab8a87

Please sign in to comment.