pub struct WidgetStateMapper<T> { /* private fields */ }Expand description
Uses a WidgetStateMap to resolve to a single value of type T based on
the current set of Widget states.
Classes that hold a WidgetStateMapper can implement any other interface,
but should only be used for fields that document their support for
WidgetStateProperty objects.
For example, a WidgetStateColor::from_map object can be passed anywhere that
accepts either a Color or a WidgetStateProperty object.
resolve panics when no key is satisfied, whatever
T; a map that should resolve to None ends with (WidgetState::any(), None).
Implementations§
Source§impl<T> WidgetStateMapper<T>
impl<T> WidgetStateMapper<T>
Sourcepub fn new(map: WidgetStateMap<T>) -> WidgetStateMapper<T>
pub fn new(map: WidgetStateMap<T>) -> WidgetStateMapper<T>
Creates a WidgetStateProperty object that can resolve
to a value of type T using the provided map.
Source§impl<T: WidgetStatePropertyValue + Debug> WidgetStateMapper<T>
impl<T: WidgetStatePropertyValue + Debug> WidgetStateMapper<T>
Trait Implementations§
Source§impl<T: Clone> Clone for WidgetStateMapper<T>
impl<T: Clone> Clone for WidgetStateMapper<T>
Source§impl<T: Debug> Debug for WidgetStateMapper<T>
impl<T: Debug> Debug for WidgetStateMapper<T>
Source§impl<T: PartialEq> PartialEq for WidgetStateMapper<T>
impl<T: PartialEq> PartialEq for WidgetStateMapper<T>
Source§impl<T: Clone + Debug + PartialEq + 'static> WidgetStateProperty<T> for WidgetStateMapper<T>
impl<T: Clone + Debug + PartialEq + 'static> WidgetStateProperty<T> for WidgetStateMapper<T>
Source§fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)
Dart’s
WidgetStateProperty.debugFillProperties, from Diagnosticable: a property
adds its own fields.Source§fn resolve(&self, states: &WidgetStates) -> T
fn resolve(&self, states: &WidgetStates) -> T
Source§fn as_mapper(&self) -> Option<&WidgetStateMapper<T>>
fn as_mapper(&self) -> Option<&WidgetStateMapper<T>>
Dart’s
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<T>) -> bool
fn eq_property(&self, other: &dyn WidgetStateProperty<T>) -> bool
Dart’s
==. Identity unless a class overrides it, as WidgetStatePropertyAll and
WidgetStateMapper do.Auto Trait Implementations§
impl<T> !RefUnwindSafe for WidgetStateMapper<T>
impl<T> !Send for WidgetStateMapper<T>
impl<T> !Sync for WidgetStateMapper<T>
impl<T> !UnwindSafe for WidgetStateMapper<T>
impl<T> Forget for WidgetStateMapper<T>
impl<T> Freeze for WidgetStateMapper<T>
impl<T> Move for WidgetStateMapper<T>
impl<T> Unpin for WidgetStateMapper<T>
impl<T> UnsafeUnpin for WidgetStateMapper<T>
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
Mutably borrows from an owned value. Read more