Skip to main content

Widget

Trait Widget 

Source
pub trait Widget: Any {
    // Required methods
    fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size;
    fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene);

    // Provided methods
    fn event(
        &mut self,
        _ctx: &mut EventCtx<'_>,
        _event: &InputEvent,
    ) -> EventResult { ... }
    fn semantics(&self, _ctx: &mut SemanticsCtx) { ... }
    fn type_name(&self) -> &'static str { ... }
    fn visit_children(&self, _visitor: &mut dyn FnMut(&ChildPod)) { ... }
    fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)> { ... }
}
Expand description

A retained UI element living in the widget tree.

Widget: Any so the render root can downcast a boxed widget back to the concrete element type its originating view produced (needed during rebuild). Implementing types get [Widget::downcast_mut] for free — no boilerplate method to write.

Required Methods§

Source

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Choose a size within bc and return it. The chosen size must satisfy bc (callers may additionally clamp via BoxConstraints::constrain).

§Layout may be skipped

Under a crate::app::RenderRoot a widget sitting in a ChildPod is not laid out every frame: ChildPod::layout_child returns the size it recorded last time, without calling this method, when the pod is clean, its constraints are equal to last time’s, the window insets it sees are unchanged, and the root’s layout epoch has not moved (see that method for the full rule). So the result of layout must be a function of bc, the context’s global inputs, and widget state that only changes through one of the channels that dirty the pod:

A widget must not change layout-affecting state any other way — a change made behind the pod’s back is invisible to the skip and lays out stale until something else dirties the path.

Source

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Emit draw commands for this widget into scene.

Paint may advance a widget’s own animation state (e.g. a scroll fling integrated from a monotonic clock) as a v1 seam. A widget that does so must call PaintCtx::request_frame while the animation is still running so the shell re-invokes paint absent any external event — otherwise the desktop ControlFlow::Wait loop idles and the animation stalls. It must stop signalling once the animation reaches rest.

Provided Methods§

Source

fn event(&mut self, _ctx: &mut EventCtx<'_>, _event: &InputEvent) -> EventResult

Handle an input event, optionally mutating application state through ctx and reporting whether it was consumed.

Defaulted to EventResult::Ignored so non-interactive widgets are unaffected. Interactive widgets (Button/Checkbox/Slider) override this; containers forward to their ChildPod children via ChildPod::event_child.

Source

fn semantics(&self, _ctx: &mut SemanticsCtx)

Contribute this widget’s accessibility node(s) into ctx.

Defaulted to a no-op so non-semantic widgets (and every widget written before this seam) are unaffected — exactly like Widget::event. A leaf widget overrides it to call SemanticsCtx::push_node with its role and state; a container overrides it to forward to each child via ChildPod::semantics_child (a transparent container contributes no node of its own, only recursion). The pass runs after layout, so SemanticsCtx::origin/SemanticsCtx::size carry valid absolute geometry.

Source

fn type_name(&self) -> &'static str

This widget’s concrete type name, for read-only tooling.

Defaulted to core::any::type_name of the implementing type, so every widget reports its own name through the vtable — including one reached as a dyn Widget, where the concrete type is otherwise unrecoverable. Asking the live widget beats recording a name when it was built: a rebuild that swaps a child’s concrete type cannot leave a stale name behind, not even through wrapper views that re-box an inner AnyView (docs/LIMITATIONS.md’s focus-wrapper-erasure-swap-blind).

Diagnostic only: type_name’s output is not a stable contract across compiler versions, so never parse or match on it. Overriding it is sanctioned only for a transparent wrapper reporting what it wraps (the Box<dyn Widget> blanket impl is the one in-crate case).

Source

fn visit_children(&self, _visitor: &mut dyn FnMut(&ChildPod))

Visit this widget’s owned ChildPods, in declaration (paint) order — the read-only seam that makes the retained hierarchy enumerable.

Containers own their children as ChildPod fields rather than as arena nodes (see ChildPod), so nothing outside a container could walk into its subtree; this is that walk, and WidgetTree::inspect is its one in-crate consumer.

Defaulted to visiting nothing, exactly like Widget::event and Widget::semantics: a leaf widget needs no impl and pays nothing, and a container that never overrides it simply reads as a leaf to tooling. It runs behind &self and must not mutate anything a pass depends on — no build/layout/paint/event behavior may be routed through it.

No cycles by construction. A ChildPod owns its widget (Box<dyn Widget>); ownership is a tree, so a descent through visit_children terminates without any runtime cycle check. A widget that handed the visitor a pod it does not own would break that, which is why the visitor takes &ChildPod — there is no way to publish a shared one.

Source

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

This widget as a sliver, if it speaks the sliver protocol — the opt-in seam a scrolling viewport lays its children out through (see crate::sliver and ChildPod::layout_sliver_child).

Defaulted to None, exactly like Widget::visit_children: a box widget needs no impl and is laid out through Widget::layout as always. A type implementing SliverWidget overrides it to return Some(self). A transparent wrapper (a type-erasing box, a component boundary, an either-arm) forwards it to what it wraps, so a sliver stays a sliver however it was erased.

Implementations§

Source§

impl dyn Widget

Source

pub fn downcast_mut<W>(&mut self) -> Option<&mut W>
where W: Widget,

Attempt to downcast this trait object to a concrete widget type.

Uses trait upcasting (Widget: Any, stable since Rust 1.86; the workspace MSRV is 1.88) — no unsafe.

Trait Implementations§

Source§

impl Widget for Box<dyn Widget>

A boxed widget is itself a Widget, delegating every pass to its contents.

This blanket impl is what makes type-erased children work: a crate::view::AnyView’s element is a Box<dyn Widget>, and View::Element must implement Widget — so the box has to be a widget too. It also lets a Box<dyn Widget> be stored inside a ChildPod like any concrete widget. Box<dyn Widget> is 'static (hence Any), so it satisfies the Widget: Any bound and can be recovered by [downcast_mut](dyn Widget::downcast_mut) during rebuild.

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

The boxed widget’s sliver face, so type erasure never hides a sliver from the viewport laying it out.

Source§

fn type_name(&self) -> &'static str

Report the boxed widget’s name, not Box<dyn Widget> — the box is a storage detail of type erasure, never a tree element in its own right, and it nests (a doubly-boxed pod resolves through both layers).

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Choose a size within bc and return it. The chosen size must satisfy bc (callers may additionally clamp via BoxConstraints::constrain). Read more
Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Emit draw commands for this widget into scene. Read more
Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Handle an input event, optionally mutating application state through ctx and reporting whether it was consumed. Read more
Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Contribute this widget’s accessibility node(s) into ctx. Read more
Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Visit this widget’s owned ChildPods, in declaration (paint) order — the read-only seam that makes the retained hierarchy enumerable. Read more

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl Widget for AlignWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for Box<dyn Widget>

A boxed widget is itself a Widget, delegating every pass to its contents.

This blanket impl is what makes type-erased children work: a crate::view::AnyView’s element is a Box<dyn Widget>, and View::Element must implement Widget — so the box has to be a widget too. It also lets a Box<dyn Widget> be stored inside a ChildPod like any concrete widget. Box<dyn Widget> is 'static (hence Any), so it satisfies the Widget: Any bound and can be recovered by [downcast_mut](dyn Widget::downcast_mut) during rebuild.

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

The boxed widget’s sliver face, so type erasure never hides a sliver from the viewport laying it out.

Source§

fn type_name(&self) -> &'static str

Report the boxed widget’s name, not Box<dyn Widget> — the box is a storage detail of type erasure, never a tree element in its own right, and it nests (a doubly-boxed pod resolves through both layers).

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for ButtonWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for CheckboxWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for FlexWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for GestureDetectorWidget

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

A detector is a sliver exactly when its child is: the transparent layout runs through the child pod, so the sliver face is the detector itself and the pod stays sized for this wrapper’s own paint and hit test (the ComponentWidget pattern).

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for HeroWidget

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

A hero is a sliver exactly when its child is. The sliver face is the hero itself, so the layout runs through the child pod and leaves it sized for this wrapper’s own paint (the ComponentWidget pattern).

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for IconButtonWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for ImageWidget

Source§

fn layout(&mut self, _ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

impl Widget for IndexedStackWidget

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Forwards the selected child only. This is the input-gating carve-out of the forward-every-child rule: the accessibility tree follows input routing (R23), and only the selected child receives input.

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for PaddingWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for PinchDetectorWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for PlatformViewWidget

Source§

fn layout(&mut self, _ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

impl Widget for RepaintBoundaryWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for SafeAreaWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for ScaffoldWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for ScrollWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for ShieldWidget

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

A shield is a sliver exactly when its child is: the transparent layout runs through the child pod, so the sliver face is the shield itself and the pod stays sized for this wrapper’s own paint (the ComponentWidget pattern).

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for SizedBoxWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for SliderWidget

Source§

fn layout(&mut self, _ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

impl Widget for SliverBoxWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Outside a viewport the adapter is transparent: the child is laid out under bc at the origin, uncut.

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

The viewport only delivers a positional event inside this sliver’s paint extent (or to a captured child), and that extent lies inside the child’s own bounds, so the ordinary single-child routing applies.

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for SliverFillRemainingWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Outside a viewport there is nothing to fill: the child is laid out under bc at the origin, uncut.

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

The viewport only delivers a positional event inside this sliver’s paint extent (or to a captured child), so the ordinary single-child routing applies.

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for SliverFixedExtentListWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Outside a viewport the list lays out as if it were the only sliver of a viewport bc.max() long, scrolled to its start: it materialises (at the next rebuild) and sizes itself to the rows that fit, or to all of them under an unbounded constraint.

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Delivers a near-edge fire observed at layout, then routes the event to the rows: the viewport only delivers a positional event inside this sliver’s paint extent, where only painted rows sit.

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for SliverGridWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Outside a viewport the grid lays out as if it were the only sliver of a viewport bc.max() long, scrolled to its start (the fixed-extent list’s rule).

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

The viewport only delivers a positional event inside this sliver’s paint extent, where only painted cells sit.

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for SliverListWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Outside a viewport the list lays out as if it were the only sliver of a viewport bc.max() long, scrolled to its start (the fixed-extent list’s rule).

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Delivers a near-edge fire observed at layout, then routes the event to the materialised rows (parked rows receive nothing).

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for SliverPaddingWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Outside a viewport the padding is a plain Padding: the child is laid out under bc deflated by the insets, at the leading insets.

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

The viewport delivers a positional event only inside this sliver’s hit-test extent, so the ordinary single-child routing applies.

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for SliverPersistentHeaderWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Outside a viewport the header is unscrolled: the child is laid out at max_extent along the axis of the last sliver layout (vertical before one), clamped into bc, and at bc’s largest finite cross extent.

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Paints the child, and requests the frame whose rebuild brings the content up to the shrink offset this frame’s layout computed.

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

The viewport delivers a positional event only inside the header’s hit-test extent (or to a captured child), so the ordinary single-child routing applies.

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn as_sliver(&mut self) -> Option<&mut (dyn SliverWidget + 'static)>

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for StackWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl Widget for TextInputWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

impl Widget for TextWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

impl Widget for ViewportWidget

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl<State> Widget for NavigatorWidget<State>
where State: 'static,

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

R23 — semantics forwarding follows input routing, exactly.

A transparent container (like Stack): the navigator contributes no node of its own and forwards ChildPod::semantics_child for exactly the pages input_routed_pages says an input event could reach — today { pages.last() }. Every other page is omitted: no node, no recursion. Offering a screen-reader user a control they physically cannot activate is worse than not offering it, so the two reaches are derived from one function rather than kept in sync by hand.

§This omits more than paint culling does

A page under a transparent overlay is PageVisibility::Visible — still painted — yet it is omitted here, because R23 tracks input routing, not painting, and route_top routes only to the top page. The divergence is deliberate: it is what makes a modal modal to assistive technology for free (the page beneath a dialog is already inert to a finger). The topmost transparent page — the dialog itself — is forwarded, since it is pages.last().

§Why omission and not an accesskit flag

Not hidden: it would need a synthesized per-page wrapper node to carry the flag (churning node ids on every navigation for nodes that exist only to say “ignore me”), it would publish the stale bounds of a covered page that layout skipped, and whether every platform adapter honours the flag is unverified — omission needs no such trust. Not clips_children, which asserts overflow: hidden and would be simply false here. Not modal, which is the right flag but belongs on the dialog widget: the navigator does not know a page is a dialog and cannot infer it from BackPolicy (most shipped modals push through push_transparent_for_result and so take the default BackPolicy::Pop).

§During a transition

No special case: pages.last() is the destination page for a push, pop and replace alike, and its mid-flight bounds are the animated pod origins paint is using — consistent with the screen and self-correcting within one transition. Input is fully suppressed mid-transition (event_at), so a screen reader activating a node during those ≤340ms hits exactly the same suppression a finger would.

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Source§

impl<State> Widget for OverlayPortalWidget<State>
where State: 'static,

Source§

fn layout(&mut self, ctx: &mut LayoutCtx<'_>, bc: &BoxConstraints) -> Size

Source§

fn paint(&mut self, ctx: &mut PaintCtx<'_>, scene: &mut dyn PaintScene)

Source§

fn event(&mut self, ctx: &mut EventCtx<'_>, event: &InputEvent) -> EventResult

Source§

fn semantics(&self, ctx: &mut SemanticsCtx)

Source§

fn visit_children(&self, visitor: &mut dyn FnMut(&ChildPod))

Implementors§

Source§

impl Widget for AnimatedOpacityWidget

Source§

impl Widget for AnimatedScaleWidget

Source§

impl Widget for AutoScrollZoneWidget

Source§

impl Widget for CanvasWidget

Source§

impl Widget for ContainerWidget

Source§

impl Widget for DividerWidget

Source§

impl Widget for IconWidget

Source§

impl Widget for KeepAliveWidget

Source§

impl Widget for ListViewWidget

Source§

impl Widget for PanZoomWidget

Source§

impl Widget for RadioWidget

Source§

impl Widget for TextureWidget

Source§

impl<A, B, C, D, E, F, G, H> Widget for EitherOf8Widget<A, B, C, D, E, F, G, H>
where A: Widget, B: Widget, C: Widget, D: Widget, E: Widget, F: Widget, G: Widget, H: Widget,

Source§

impl<A, B, C, D, E, F, G> Widget for EitherOf7Widget<A, B, C, D, E, F, G>
where A: Widget, B: Widget, C: Widget, D: Widget, E: Widget, F: Widget, G: Widget,

Source§

impl<A, B, C, D, E, F> Widget for EitherOf6Widget<A, B, C, D, E, F>
where A: Widget, B: Widget, C: Widget, D: Widget, E: Widget, F: Widget,

Source§

impl<A, B, C, D, E> Widget for EitherOf5Widget<A, B, C, D, E>
where A: Widget, B: Widget, C: Widget, D: Widget, E: Widget,

Source§

impl<A, B, C, D> Widget for EitherOf4Widget<A, B, C, D>
where A: Widget, B: Widget, C: Widget, D: Widget,

Source§

impl<A, B, C> Widget for EitherOf3Widget<A, B, C>
where A: Widget, B: Widget, C: Widget,

Source§

impl<C> Widget for ComponentWidget<C>
where C: Component,

Source§

impl<L, R> Widget for EitherWidget<L, R>
where L: Widget, R: Widget,

Source§

impl<P> Widget for PatternSwitcherWidget<P>
where P: TransitionPattern + Clone + 'static,

Source§

impl<State, T> Widget for DragTargetWidget<State, T>
where State: 'static, T: 'static,

Source§

impl<State, T> Widget for DraggableWidget<State, T>
where State: 'static, T: 'static,