Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System Brightness does not work in FluentApp on Windows #194

Closed
RemcoSchrijver opened this issue Feb 21, 2022 · 1 comment
Closed

System Brightness does not work in FluentApp on Windows #194

RemcoSchrijver opened this issue Feb 21, 2022 · 1 comment
Labels
invalid This doesn't seem right

Comments

@RemcoSchrijver
Copy link

RemcoSchrijver commented Feb 21, 2022

The defined system brightness does not function when on used on Windows in combination with a FluentApp.

The following line does not work:

final platformBrightness = MediaQuery.platformBrightnessOf(context);

Workaround right now is:
FluentApp( theme: ThemeData( brightness: MediaQueryData.fromWindow(WidgetsBinding.instance!.window).platformBrightness, ) )

Not entirely sure if there is a better way to do this?

@WinXaito
Copy link
Collaborator

The following line does not work:

In fact, yes that's work. That's only doesn't work on root context. Do this for confirm that:

builder: (context, _) {
    print(MediaQuery.platformBrightnessOf(context));
    return Text('text')
},

flutter: Brightness.dark


Your theme is not correct, because you need to create a themeData for dark and light theme.

Add this for resolve your problem:

return FluentApp(
  themeMode: ThemeMode.system,
  theme: ThemeData(
    brightness: Brightness.light,
  ),
  darkTheme: ThemeData(
    brightness: Brightness.dark,
  ),
  ...
);

Please reopen this issue if that doesn't solve your problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants