pub struct Pressable<W: Widget> { /* private fields */ }Expand description
Makes ANY widget clickable — the whole child rect becomes a press target (clip-aware, z-ordered, persistent via the render tree).
Usually created through the blanket PressApi:
ⓘ
Text::new("tap me").on_press(|| do_thing())
Card::new(content).on_press(open_details)Widgets with their own on_press builder (Button, ListTile) keep it —
inherent methods win. Press/hover visual feedback (the InkWell ripple)
arrives with the interaction-states work; this is the hit plumbing.
Implementations§
Trait Implementations§
Source§impl<W: Widget + Send + Sync + 'static> Widget for Pressable<W>
impl<W: Widget + Send + Sync + 'static> Widget for Pressable<W>
Source§fn children(&self) -> Children<'_>
fn children(&self) -> Children<'_>
Declare this widget’s children. Drives every default below.
Source§fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
Measure under
ctx.constraints and return a size within them. Read moreSource§fn flex_factor(&self) -> f32
fn flex_factor(&self) -> f32
Flex weight inside Row/Column. Wrappers are transparent by default.
Auto Trait Implementations§
impl<W> !RefUnwindSafe for Pressable<W>
impl<W> !UnwindSafe for Pressable<W>
impl<W> Freeze for Pressable<W>where
W: Freeze,
impl<W> Send for Pressable<W>
impl<W> Sync for Pressable<W>
impl<W> Unpin for Pressable<W>where
W: Unpin,
impl<W> UnsafeUnpin for Pressable<W>where
W: UnsafeUnpin,
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
Source§impl<W> FocusApi for W
impl<W> FocusApi for W
Source§fn focus_node(self, node: FocusNode) -> WithFocus<Self>
fn focus_node(self, node: FocusNode) -> WithFocus<Self>
Attach a focus node. This enables focus-ring rendering and explicit
neighbor wiring.