dynamic_theme icon indicating copy to clipboard operation
dynamic_theme copied to clipboard

Option to default to platform brightness on Android Q

Open pbaker5 opened this issue 6 years ago • 6 comments

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.

pbaker5 avatar May 27 '19 04:05 pbaker5

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)?

Norbert515 avatar May 27 '19 17:05 Norbert515

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

pbaker5 avatar May 27 '19 23:05 pbaker5

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.

Norbert515 avatar May 30 '19 18:05 Norbert515

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.

sterrenb avatar Aug 09 '19 09:08 sterrenb

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.

TheLastGimbus avatar May 09 '20 11:05 TheLastGimbus

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.

sterrenb avatar May 14 '20 22:05 sterrenb