Closed eauw closed 4 months ago
Hey @eauw,
Seems you want to know brightness information to determine whether you should show light or dark logo. Easiest way is to use brightness
either from your Theme
or AdaptiveTheme
.
// option 1
AdaptiveTheme.of(context).brightness == Brightness.dark
// option 2
Theme.of(context).brightness == Brightness.light
Another way to know the system brightness is (however you should only do this when theme mode is set to system, Above solution works always though)
final brightness = WidgetsBinding.instance.platformDispatcher.platformBrightness;
I hope this helps! Feel free to reopen the issue if this doesn't work for you!
@BirjuVachhani thank you very much! Exactly what I needed.
Is your feature request related to a problem? Please describe. I'm initializing AdaptiveTheme() with
initial: AdaptiveThemeMode.system,
for best user experience. But for later ui logic like picking the light or dark logo I can't know if the system is light or dark.Describe the solution you'd like I would like to do something like
AdaptiveTheme.of(context).mode.isSystem == AdaptiveThemeMode.light
to check what system is currently. But both checks always return false.