Skip to content

fix(theme): listen to platformDispatcher.onPlatformBrightnessChanged for ThemeMode.system - #956

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
issue/899-platform-brightness-listener
Sep 25, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
issue/899-platform-brightness-listener

Conversation

@ZhuchkaTriplesix

Copy link
Copy Markdown
Member

Summary

  • Register WidgetsBindingObserver inside ThemeController when _themeMode == ThemeMode.system to observe OS brightness changes.
  • Implement didChangePlatformBrightness to invoke _notifyThemeChanged() when the platform brightness actually changes, cleanly triggering UI theme recomputation.
  • Ensure the observer is automatically unregistered when switching to ThemeMode.light or ThemeMode.dark, on resetToDefaults(), and on dispose().
  • Add unit tests verifying dynamic brightness transitions and observer cleanup.

Closes #899

@github-actions github-actions Bot added bug Something isn't working theme Theming, colors, VS Code themes labels Sep 25, 2026
@github-actions github-actions Bot added this to the Theme system milestone Sep 25, 2026
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit 598d7fa into dev Sep 25, 2026
4 checks passed
@ZhuchkaTriplesix
ZhuchkaTriplesix deleted the issue/899-platform-brightness-listener branch September 28, 2026 08:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working theme Theming, colors, VS Code themes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant