pub struct Status {Show 24 fields
pub interaction: Interaction,
pub focused: bool,
pub cursor: Option<usize>,
pub selection: Option<(usize, usize)>,
pub composing: Option<(usize, usize)>,
pub toolbar: Option<bool>,
pub handles: bool,
pub region: Option<(usize, usize)>,
pub region_bar: bool,
pub region_grips: (Option<usize>, Option<usize>),
pub caret_hidden: bool,
pub drag_over: bool,
pub hover_progress: f32,
pub focus_progress: f32,
pub press_progress: f32,
pub opacity: f32,
pub value: f32,
pub time: f32,
pub anim_color: Option<Color>,
pub anim_radius: Option<BorderRadius>,
pub scroll_y: f32,
pub hover_cursor: Option<Point>,
pub value_placed: bool,
pub thumb: Option<usize>,
}Expand description
A widget’s complete status for one frame: pointer interaction, focus, caret and selection (for fields), animation progress and opacity.
Fields§
§interaction: InteractionWhether the pointer is over the widget or pressing it.
focused: boolWhether the widget holds the keyboard focus.
cursor: Option<usize>The caret’s (character) index, if this widget is a focused field.
selection: Option<(usize, usize)>The selected (start, end) range, in character indices.
composing: Option<(usize, usize)>The (start, end) range being composed by the IME (provisional,
underlined text); None outside composition. In character indices.
toolbar: Option<bool>Is the field’s bar (Cut, Copy, Paste, Select all) showing over its selection?
Some(can_paste) when it is — with whether the clipboard held text when it opened —
and None otherwise. Set by the shell, and only for the focused field.
handles: boolDoes the selection carry handles? A selection made with a finger does — a long press on a word — and one made with a mouse or the keyboard does not. Set by the shell, and only for the focused field.
region: Option<(usize, usize)>The (start, end) range of this text that a SelectionArea’s
selection covers, in characters. Kept by the shell, for any text in the area whether or
not it has the focus — which is the difference from selection, a field’s own.
region_bar: boolDoes the selection a selection area holds show its bar? Set for every text the selection covers; the first of them in reading order carries the bar.
region_grips: (Option<usize>, Option<usize>)The handles of a selection area’s touch selection that hang from this text: the character where the selection starts, if it starts here, and the boundary where it ends, if it ends here.
Is the caret in the hidden half of its blink? Set by the shell, and only for the focused field; a field paints no caret while it is.
drag_over: boolIs a drag currently over this widget, and would it be accepted? Only
ever true for a crate::DragTarget; it is what lets one paint the “drop it
here” state itself rather than have the shell paint it from outside.
hover_progress: f32The hover transition’s progress (0.0..=1.0).
focus_progress: f32The focus transition’s progress (0.0..=1.0).
press_progress: f32The press transition’s progress (0.0..=1.0): the animated form of
Interaction::Pressed, as hover_progress is the animated form of
Interaction::Hovered.
A press used to be a flag and nothing else, so every state layer and every held
radius in the crate reached full the instant a finger landed and vanished the
instant it left. The reference fades its press highlight over 200 ms against the
50 ms it gives hover and focus (ink_well.dart:995) — the press is the slower
of the two, which is the opposite of what a flag does.
interaction stays for the decisions that really are discrete — is this the
widget being held? — and this is what the paint reads.
opacity: f32The opacity to apply (a fade-in); 1.0 = opaque.
value: f32The widget’s own animated value (a switch’s 0 → 1, for instance), driven
by Widget::anim_target.
time: f32The time elapsed (in seconds) since start-up — for continuous,
time-driven animations (a CircularProgressIndicator, for instance).
anim_color: Option<Color>The interpolated color of an animated background
(Container::animated_color) while in transition; None = no animated
color, and the widget uses its own.
anim_radius: Option<BorderRadius>The interpolated corner radius (Container::animated_radius) while in
transition; None = a fixed radius, and the widget uses its own.
scroll_y: f32This widget’s retained vertical scroll (in px), for widgets that scroll
their own content (a multi-line field); 0 otherwise.
hover_cursor: Option<Point>The pointer’s absolute position when it hovers an interactive sub-region of
this widget (milestone 208); None otherwise. The widget brings it back to local
coordinates through its bounds to highlight the targeted zone (a suffix icon…).
Set by the shell from cursor_icon.
value_placed: boolWas value placed by a finger — held by a drag, or settling from where one let
go (milestone 638)? A widget that curves its value paints it straight while it is:
the thumb under a finger is where the finger is.
thumb: Option<usize>Which of this widget’s thumbs the last drag on it took (milestone 651), on a
track with two: 0 the start, 1 the end. It stays after the drag ends, as the
reference’s last selection does, so that the thumb last moved stays on top and its
press fades out on it rather than on its neighbour. Set by the shell.
Implementations§
Source§impl Status
impl Status
Sourcepub fn states(&self) -> WidgetStates
pub fn states(&self) -> WidgetStates
The states this widget is in, as a WidgetStateProperty resolves against
(widget_state.dart:168).
Three of the eight, because three are all a status honestly knows: hovered,
focused and pressed. Selected, Disabled, Error, Dragged and
ScrolledUnder are the widget’s own to add with
WidgetStates::set — nothing outside a checkbox knows whether it is ticked, and
a status that guessed would be wrong for every widget that never selects anything.
It reads the flags, not the fades: a property is a step between values, and where the change should be gradual the widget animates between two resolved values rather than resolving a fraction. See the module note.
Trait Implementations§
impl Copy for Status
impl StructuralPartialEq for Status
Auto Trait Implementations§
impl Freeze for Status
impl RefUnwindSafe for Status
impl Send for Status
impl Sync for Status
impl Unpin for Status
impl UnsafeUnpin for Status
impl UnwindSafe for Status
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.