Skip to content

Android Dark Mode #25525

@Hixie

Description

@Hixie

Since Froyo, Android has had a Dark Mode feature. We should implement it.

This Java code detects if it's enabled:

(mContext.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK) == Configuration.UI_MODE_NIGHT_YES;

The activity or fragment's onConfigurationChange apparently triggers when this changes.

We should propagate this state to the MediaQuery somehow (via a system channel, I guess, though we would need to find a way to send the data early in the process so that it's available on first build).

MaterialApp should switch between its regular theme and a darkTheme automatically based on this setting.

cc @HansMuller, @matthew-carroll, @jason-simmons

Metadata

Metadata

Labels

engineflutter/engine related. See also e: labels.f: material designflutter/packages/flutter/material repository.frameworkflutter/packages/flutter repository. See also f: labels.platform-androidAndroid applications specifically

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions