diff --git a/lib/screens/audio_service_settings_screen.dart b/lib/screens/audio_service_settings_screen.dart index a3825fbf..d07c13ed 100644 --- a/lib/screens/audio_service_settings_screen.dart +++ b/lib/screens/audio_service_settings_screen.dart @@ -21,23 +21,31 @@ class AudioServiceSettingsScreen extends StatefulWidget { class _AudioServiceSettingsScreenState extends State { + // Overwriting this value causes the childrens to update + // this is a required workaround because some input fields + // might not update when resetting to defaults + Key _updateChildren = UniqueKey(); @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text(AppLocalizations.of(context)!.audioService), actions: [ - FinampSettingsHelper.makeSettingsResetButtonWithDialog( - context, FinampSettingsHelper.resetAudioServiceSettings) + FinampSettingsHelper.makeSettingsResetButtonWithDialog(context, () { + setState(() { + FinampSettingsHelper.resetAudioServiceSettings(); + _updateChildren = UniqueKey(); // Trigger rebuilding of Children + }); + }) ], ), body: ListView( children: [ - if (Platform.isAndroid) const StopForegroundSelector(), - const SongShuffleItemCountEditor(), - const BufferDurationListTile(), + if (Platform.isAndroid) StopForegroundSelector(key: _updateChildren), + SongShuffleItemCountEditor(key: _updateChildren), + BufferDurationListTile(key: _updateChildren), const LoadQueueOnStartupSelector(), - const PeriodicPlaybackSessionUpdateFrequencyEditor(), + PeriodicPlaybackSessionUpdateFrequencyEditor(key: _updateChildren), const ReportQueueToServerToggle(), ], ), diff --git a/lib/screens/volume_normalization_settings_screen.dart b/lib/screens/volume_normalization_settings_screen.dart index b3f526d9..ca7d1923 100644 --- a/lib/screens/volume_normalization_settings_screen.dart +++ b/lib/screens/volume_normalization_settings_screen.dart @@ -18,6 +18,10 @@ class VolumeNormalizationSettingsScreen extends StatefulWidget { class _VolumeNormalizationSettingsScreenState extends State { + // Overwriting this value causes the childrens to update + // this is a required workaround because some input fields + // might not update when resetting to defaults + Key _updateChildren = UniqueKey(); @override Widget build(BuildContext context) { return Scaffold( @@ -25,14 +29,19 @@ class _VolumeNormalizationSettingsScreenState title: Text( AppLocalizations.of(context)!.volumeNormalizationSettingsTitle), actions: [ - FinampSettingsHelper.makeSettingsResetButtonWithDialog( - context, FinampSettingsHelper.resetNormalizationSettings) + FinampSettingsHelper.makeSettingsResetButtonWithDialog(context, () { + setState(() { + FinampSettingsHelper.resetNormalizationSettings(); + _updateChildren = UniqueKey(); // Trigger rebuilding of Children + }); + }) ], ), body: ListView( children: [ const VolumeNormalizationSwitch(), - if (!Platform.isAndroid) const VolumeNormalizationIOSBaseGainEditor(), + if (!Platform.isAndroid) + VolumeNormalizationIOSBaseGainEditor(key: _updateChildren), const VolumeNormalizationModeSelector(), ], ),