pub enum WidgetState {
Hovered,
Focused,
Pressed,
Dragged,
Selected,
ScrolledUnder,
Disabled,
Error,
}Expand description
Interactive states that some of the widgets can take on when receiving input from the user.
States are defined by https://m3.material.io/foundations/interaction/states, but are not limited to the Material design system or library.
Some widgets track their current state in a WidgetStates set.
See also:
MaterialState, the Material specific version ofWidgetState.WidgetStateProperty, an interface for objects that “resolve” to different values depending on a widget’s state.WidgetStateColor, aColorthat implementsWidgetStatePropertywhich is used in APIs that need to accept either aColoror aWidgetStateProperty<Color>.WidgetStateMouseCursor, aMouseCursorthat implementsWidgetStatePropertywhich is used in APIs that need to accept either aMouseCursoror aWidgetStateProperty<MouseCursor>.WidgetStateOutlinedBorder, anOutlinedBorderthat implementsWidgetStatePropertywhich is used in APIs that need to accept either anOutlinedBorderor aWidgetStateProperty<OutlinedBorder>.WidgetStateBorderSide, aBorderSidethat implementsWidgetStatePropertywhich is used in APIs that need to accept either aBorderSideor aWidgetStateProperty<BorderSide>.WidgetStateTextStyle, aTextStylethat implementsWidgetStatePropertywhich is used in APIs that need to accept either aTextStyleor aWidgetStateProperty<TextStyle>.
Variants§
Hovered
The state when the user drags their mouse cursor over the given widget.
See: https://material.io/design/interaction/states.html#hover.
Focused
The state when the user navigates with the keyboard to a given widget.
This can also sometimes be triggered when a widget is tapped. For example,
when a TextField is tapped, it becomes Focused.
See: https://material.io/design/interaction/states.html#focus.
Pressed
The state when the user is actively pressing down on the given widget.
See: https://material.io/design/interaction/states.html#pressed.
Dragged
The state when this widget is being dragged from one place to another by the user.
Selected
The state when this item has been selected.
This applies to things that can be toggled (such as chips and checkboxes) and things that are selected from a set of options (such as tabs and radio buttons).
See: https://material.io/design/interaction/states.html#selected.
ScrolledUnder
The state when this widget overlaps the content of a scrollable below.
Used by AppBar to indicate that the primary scrollable’s
content has scrolled up and behind the app bar.
Disabled
The state when this widget is disabled and cannot be interacted with.
Disabled widgets should not respond to hover, focus, press, or drag interactions.
See: https://material.io/design/interaction/states.html#disabled.
Error
The state when the widget has entered some form of invalid state.
See https://material.io/design/interaction/states.html#usage.
Implementations§
Source§impl WidgetState
impl WidgetState
Sourcepub fn any() -> WidgetStatesConstraintRef
pub fn any() -> WidgetStatesConstraintRef
To prevent a situation where each WidgetStatesConstraint
isn’t satisfied by the given set of states, consider adding
WidgetState::any as the final WidgetStateMap key.
Trait Implementations§
Source§impl<R: Into<WidgetStatesConstraintRef>> BitAnd<R> for WidgetState
impl<R: Into<WidgetStatesConstraintRef>> BitAnd<R> for WidgetState
Source§fn bitand(self, other: R) -> WidgetStatesConstraintRef
fn bitand(self, other: R) -> WidgetStatesConstraintRef
Combines two WidgetStatesConstraint values using logical “and”.
Source§type Output = WidgetStatesConstraintRef
type Output = WidgetStatesConstraintRef
& operator.Source§impl<R: Into<WidgetStatesConstraintRef>> BitOr<R> for WidgetState
impl<R: Into<WidgetStatesConstraintRef>> BitOr<R> for WidgetState
Source§fn bitor(self, other: R) -> WidgetStatesConstraintRef
fn bitor(self, other: R) -> WidgetStatesConstraintRef
Combines two WidgetStatesConstraint values using logical “or”.
Source§type Output = WidgetStatesConstraintRef
type Output = WidgetStatesConstraintRef
| operator.Source§impl Clone for WidgetState
impl Clone for WidgetState
impl Copy for WidgetState
Source§impl Debug for WidgetState
impl Debug for WidgetState
impl Eq for WidgetState
Source§impl Hash for WidgetState
impl Hash for WidgetState
Source§impl Not for WidgetState
impl Not for WidgetState
Source§fn not(self) -> WidgetStatesConstraintRef
fn not(self) -> WidgetStatesConstraintRef
Takes a WidgetStatesConstraint and applies the logical “not”.
Source§type Output = WidgetStatesConstraintRef
type Output = WidgetStatesConstraintRef
! operator.Source§impl PartialEq for WidgetState
impl PartialEq for WidgetState
impl StructuralPartialEq for WidgetState
Source§impl WidgetStatesConstraint for WidgetState
impl WidgetStatesConstraint for WidgetState
Source§fn is_satisfied_by(&self, states: &WidgetStates) -> bool
fn is_satisfied_by(&self, states: &WidgetStates) -> bool
states satisfy this object’s criteria. Read moreSource§fn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
is checks between constraint classes.Source§fn eq_constraint(&self, other: &dyn WidgetStatesConstraint) -> bool
fn eq_constraint(&self, other: &dyn WidgetStatesConstraint) -> bool
==. Identity unless a class overrides it, as the combinators do.Auto Trait Implementations§
impl Forget for WidgetState
impl Freeze for WidgetState
impl Move for WidgetState
impl RefUnwindSafe for WidgetState
impl Send for WidgetState
impl Sync for WidgetState
impl Unpin for WidgetState
impl UnsafeUnpin for WidgetState
impl UnwindSafe for WidgetState
Blanket Implementations§
Source§impl<T> AnyEq for T
impl<T> AnyEq for T
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<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.