diff --git a/lib/main.dart b/lib/main.dart index adeaf3d..a81f1a6 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -56,12 +56,24 @@ class _AppState extends State { //TODO: wait until settings is ready? settings.onChange().listen((_) { setState(() { - if (!settings.useSystemColors) { + if (settings.useSystemColors) { + brightness = SchedulerBinding.instance.platformDispatcher.platformBrightness; + } else { brightness = settings.darkMode ? Brightness.dark : Brightness.light; } }); }); + // Listen to changes to the system brightness mode, update accordingly + final dispatcher = SchedulerBinding.instance.platformDispatcher; + dispatcher.onPlatformBrightnessChanged = () { + if (settings.useSystemColors) { + setState(() { + brightness = dispatcher.platformBrightness; + }); + } + }; + super.initState(); }