pub struct WidgetStateTextStyle { /* private fields */ }Expand description
Defines a TextStyle that is also a WidgetStateProperty.
This class exists to enable widgets with TextStyle valued properties to also accept
WidgetStateProperty<TextStyle> values. A widget state text style property represents a
text style which depends on a widget’s “interactive state”. This state is represented as
a set of WidgetStates, like WidgetState::Pressed, WidgetState::Focused and
WidgetState::Hovered.
WidgetStateTextStyle should only be used with widgets that document their support,
like InputDecoration.labelStyle.
It is the TextStyle it is in Dart once erased with into_any (or
.into()): an AnyTextStyle whose value is Dart’s super value, the empty
TextStyle(), and whose extension is this object, recovered with
style.extension::<WidgetStateTextStyle>().
Implementations§
Source§impl WidgetStateTextStyle
impl WidgetStateTextStyle
Sourcepub fn resolve_with(
callback: impl Fn(&WidgetStates) -> TextStyle + 'static,
) -> WidgetStateTextStyle
pub fn resolve_with( callback: impl Fn(&WidgetStates) -> TextStyle + 'static, ) -> WidgetStateTextStyle
Creates a WidgetStateTextStyle from a WidgetPropertyResolver<TextStyle>
callback function.
If used as a regular text style, the style resolved in the default state (the empty set of states) will be used.
The given callback parameter must return a non-null text style in the default state.
Sourcepub fn from_map(map: WidgetStateMap<TextStyle>) -> WidgetStateTextStyle
pub fn from_map(map: WidgetStateMap<TextStyle>) -> WidgetStateTextStyle
Creates a WidgetStateTextStyle from a WidgetStateMap<TextStyle>.
This constructor’s resolve method finds the first
entry whose key is satisfied by the set of states, and returns its associated value.
Sourcepub fn into_any(self) -> AnyTextStyle
pub fn into_any(self) -> AnyTextStyle
The style as the TextStyle it is in Dart: the empty style, carrying this object as
the extension.
Trait Implementations§
Source§impl Debug for WidgetStateTextStyle
impl Debug for WidgetStateTextStyle
Source§impl From<WidgetStateTextStyle> for AnyTextStyle
impl From<WidgetStateTextStyle> for AnyTextStyle
Source§fn from(style: WidgetStateTextStyle) -> AnyTextStyle
fn from(style: WidgetStateTextStyle) -> AnyTextStyle
Source§impl TextStyleExtension for WidgetStateTextStyle
impl TextStyleExtension for WidgetStateTextStyle
Source§fn eq_extension(&self, other: &dyn TextStyleExtension) -> bool
fn eq_extension(&self, other: &dyn TextStyleExtension) -> bool
== override on the subclass, called once the values compared equal. other
is the same runtime type when it downcasts; any other type is unequal, as Dart’s
runtimeType check makes it.Source§impl WidgetStateProperty<TextStyle> for WidgetStateTextStyle
impl WidgetStateProperty<TextStyle> for WidgetStateTextStyle
Source§fn resolve(&self, states: &WidgetStates) -> TextStyle
fn resolve(&self, states: &WidgetStates) -> TextStyle
Source§fn as_mapper(&self) -> Option<&WidgetStateMapper<TextStyle>>
fn as_mapper(&self) -> Option<&WidgetStateMapper<TextStyle>>
other is WidgetStateMapper<T>: the mapper this property is, if it is one,
as the private mapper subclasses of WidgetStateColor and the rest are.Source§fn eq_property(&self, other: &dyn WidgetStateProperty<TextStyle>) -> bool
fn eq_property(&self, other: &dyn WidgetStateProperty<TextStyle>) -> bool
==. Identity unless a class overrides it, as WidgetStatePropertyAll and
WidgetStateMapper do.Source§fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
WidgetStateProperty.debugFillProperties, from Diagnosticable: a property
adds its own fields.