pub enum ThemeMode {
System,
Light,
Dark,
}Expand description
Re-export: size classes and orientation, so the application can drive its own
responsive behaviour.
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.
Trait Implementations§
impl Copy for ThemeMode
impl Eq for ThemeMode
impl StructuralPartialEq for ThemeMode
Auto Trait Implementations§
impl Freeze for ThemeMode
impl RefUnwindSafe for ThemeMode
impl Send for ThemeMode
impl Sync for ThemeMode
impl Unpin for ThemeMode
impl UnsafeUnpin for ThemeMode
impl UnwindSafe for ThemeMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.