pub enum ThemeMode {
System,
Light,
Dark,
}Expand description
Which of an application’s themes is on display (app.dart:57).
An application supplies a light theme and, if it has one, a dark theme; this says
which of the two the framework picks. It is a question about the application, not
about the device: Brightness is what the platform reports, and
System is the mode that agrees to follow it.
The framework resolves this once a frame and fades between the answers, so an application never has to read the platform’s brightness or write a crossfade of its own.
Variants§
System
Follow the platform: the dark theme where the system asks for a dark interface, the light one otherwise. The default, and the answer most applications want.
Light
The light theme, whatever the platform says.
Dark
The dark theme, whatever the platform says — falling back to the light one when the application has no dark theme to give.
Implementations§
Source§impl ThemeMode
impl ThemeMode
Sourcepub const fn wants_dark(self, brightness: Brightness) -> bool
pub const fn wants_dark(self, brightness: Brightness) -> bool
Does this mode want a dark interface on a platform reporting brightness?
The one line the whole light/dark decision comes down to (app.dart:1000), and
the reason it lives here rather than in the shell: an application that shows a
theme setting with a System entry needs the same answer to tick the right row.