Skip to main content

WidgetStateBorderSide

Struct WidgetStateBorderSide 

Source
pub struct WidgetStateBorderSide { /* private fields */ }
Expand description

Defines a BorderSide whose value depends on a set of WidgetStates which represent the interactive state of a component.

To use a WidgetStateBorderSide, you can either:

  1. Create a subclass of WidgetStateBorderSide and implement the abstract resolve method.
  2. Use WidgetStateBorderSide::resolve_with and pass in a callback that will be used to resolve the color in the given states.
  3. Use WidgetStateBorderSide::from_map to assign a value using a WidgetStateMap.

If a WidgetStateBorderSide is used for a property or a parameter that doesn’t support resolving WidgetStateProperty<Option<BorderSide>>s, then its default value will be used for all states.

It is the BorderSide it is in Dart once erased with into_any (or .into()): an AnyBorderSide whose value is Dart’s super value, the default BorderSide, and whose extension is this object, recovered with side.extension::<WidgetStateBorderSide>().

Implementations§

Source§

impl WidgetStateBorderSide

Source

pub fn resolve_with( callback: impl Fn(&WidgetStates) -> Option<BorderSide> + 'static, ) -> WidgetStateBorderSide

Creates a WidgetStateBorderSide from a WidgetPropertyResolver<Option<BorderSide>> callback function.

If used as a regular BorderSide, its behavior matches an empty BorderSide() constructor.

Source

pub fn from_map( map: WidgetStateMap<Option<BorderSide>>, ) -> WidgetStateBorderSide

Creates a WidgetStateBorderSide from a WidgetStateMap.

This constructor’s resolve method finds the first entry whose key is satisfied by the set of states, and returns its associated value.

Source

pub fn into_any(self) -> AnyBorderSide

The side as the BorderSide it is in Dart: the default BorderSide, carrying this object as the extension.

Source

pub fn lerp( a: Option<WidgetStatePropertyRef<Option<BorderSide>>>, b: Option<WidgetStatePropertyRef<Option<BorderSide>>>, t: f64, ) -> Option<WidgetStatePropertyRef<Option<BorderSide>>>

Linearly interpolate between two WidgetStatePropertys of BorderSide.

Trait Implementations§

Source§

impl BorderSideExtension for WidgetStateBorderSide

Source§

fn as_any(&self) -> &dyn Any

The extension as Any, for Dart’s is checks (AnyBorderSide::extension).
Source§

fn eq_extension(&self, other: &dyn BorderSideExtension) -> bool

Dart’s == 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 Debug for WidgetStateBorderSide

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<WidgetStateBorderSide> for AnyBorderSide

Source§

fn from(side: WidgetStateBorderSide) -> AnyBorderSide

Converts to this type from the input type.
Source§

impl WidgetStateProperty<Option<BorderSide>> for WidgetStateBorderSide

Source§

fn resolve(&self, states: &WidgetStates) -> Option<BorderSide>

Returns a value of type T that depends on states. Read more
Source§

fn as_any(&self) -> &dyn Any

Downcast support for Dart’s is checks in ==.
Source§

fn as_mapper(&self) -> Option<&WidgetStateMapper<Option<BorderSide>>>

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<Option<BorderSide>>, ) -> bool

Dart’s ==. Identity unless a class overrides it, as WidgetStatePropertyAll and WidgetStateMapper do.
Source§

fn debug_fill_properties(&self, properties: &mut DiagnosticPropertiesBuilder)

Dart’s WidgetStateProperty.debugFillProperties, from Diagnosticable: a property adds its own fields.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>