Norbert515 / dynamic_theme

Dynamically changing your theme without hassle
MIT License
322 stars 68 forks source link

Option to default to platform brightness on Android Q #21

Open pbaker5 opened 5 years ago

pbaker5 commented 5 years ago

On Android Q I'd like to use the OS's Theme option (which is exposed via MediaQuery.of(context).platformBrightness) instead of having another checkbox in my settings section of my app. Can we please have an option to use that as the defaultBrightness? Then I can simply check for Android Q and hide the dark mode checkbox in my settings screen.

Norbert515 commented 5 years ago

Do you think forcing the app to be dark when the platformBrightness is set to dark is okay (without allowing the user to switch back in the app)?

pbaker5 commented 5 years ago

Yes. I think the OS setting makes the app setting redundant.

Norbert515 commented 5 years ago

We'd still want to have the ability to overwrite that (especially for backward compatibility sake!).

I'm pretty busy over the next couple of days, if you want to, you can open a PR for this, if not I'll look into it once I find the time.

sterrenb commented 5 years ago

Yes. I think the OS setting makes the app setting redundant.

I agree, perhaps adding a UI toggle for overriding the OS setting would be nice too.

TheLastGimbus commented 4 years ago

This should be easy with flutter. Just set ThemeMode.system. Or it's not, I don't fully know how dynamic_theme works under the hood.

sterrenb commented 4 years ago

The easiest way seems to be indeed setting MaterialApp.themeMode.

This can be quickly implemented with Provider. This untested example seems to work for me.