Skip to main content

Sheet

Struct Sheet 

Source
pub struct Sheet {
    pub child: BoxedWidget,
    pub radius: f32,
    pub padding: EdgeInsets,
    pub show_handle: bool,
    /* private fields */
}
Expand description

A bottom sheet surface: full-width panel with rounded top corners and a grab handle. Pair with OverlayApi::sheet, which anchors it to the bottom edge and supplies the scrim + tap-to-dismiss.

Height (D115/Phase 32 Step 1): natural content height by default; Sheet::height fixes it, Sheet::detent takes a fraction of the window, Sheet::full_screen takes all of it. Sheet::scrollable wraps the content in a ScrollView so it scrolls when it overflows the sheet. Sheet::background / Sheet::handle_color replace the theme-derived defaults.

Fields§

§child: BoxedWidget§radius: f32§padding: EdgeInsets§show_handle: bool

Implementations§

Source§

impl Sheet

Source

pub fn new(child: impl Widget + 'static) -> Self

Source

pub fn radius(self, r: f32) -> Self

Source

pub fn padding(self, p: EdgeInsets) -> Self

Source

pub fn no_handle(self) -> Self

Source

pub fn height(self, h: f32) -> Self

A fixed sheet height in logical pixels (capped at the window height).

Source

pub fn detent(self, fraction: f32) -> Self

A detent: the sheet takes this fraction (0..=1) of the available height — .detent(0.5) is the half-open sheet.

Source

pub fn full_screen(self) -> Self

Take the full available height — the full-screen presentation (still bottom-anchored, still rounded at the top).

Source

pub fn background(self, c: Color) -> Self

Sheet fill — defaults to the theme’s surface.

Source

pub fn handle_color(self, c: Color) -> Self

Grab-handle color — defaults to the theme’s outline.

Source

pub fn material(self, m: ShaderMaterial) -> Self

Per-instance shader material — replaces the surface fill when resolved. Beats the theme’s SheetMaterial default (D124 Step 5).

Source

pub fn scrollable(self) -> Self

Wrap the content in a ScrollView so it scrolls when it overflows the sheet’s height. Without an explicit Sheet::height / Sheet::detent, a scrollable sheet has no natural content height and takes the full available height.

The scroll position lives in a controller created here — it persists as long as this Sheet instance does (an overlay entry’s widget survives until its owner repaints). For a position that survives owner rebuilds too, keep a ScrollController in app state and pass it to Sheet::scrollable_with.

Source

pub fn scrollable_with(self, controller: ScrollController) -> Self

Sheet::scrollable with an app-owned ScrollController — the scroll position (and programmatic scrolling) survives rebuilds. The explicit controller also keeps the scroll view on the base (CPU-painted) path, which is what overlay content requires.

Trait Implementations§

Source§

impl Widget for Sheet

Source§

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

Measure under ctx.constraints and return a size within them. Read more
Source§

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

Record draw commands for ctx.rect. Read more
Source§

fn children(&self) -> Children<'_>

Declare this widget’s children. Drives every default below.
Source§

fn flex_factor(&self) -> f32

Flex weight inside Row/Column. Wrappers are transparent by default.
Source§

fn into_element(self) -> Element
where Self: Sized + 'static,

Wrap this widget in an Element so it can be returned from Component::build().

Auto Trait Implementations§

§

impl !RefUnwindSafe for Sheet

§

impl !UnwindSafe for Sheet

§

impl Freeze for Sheet

§

impl Send for Sheet

§

impl Sync for Sheet

§

impl Unpin for Sheet

§

impl UnsafeUnpin for Sheet

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<W> FocusApi for W
where W: Widget + Send + Sync + 'static,

Source§

fn focus_node(self, node: FocusNode) -> WithFocus<Self>

Attach a focus node. This enables focus-ring rendering and explicit neighbor wiring.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<W> HeroApi for W
where W: Widget + Send + Sync + 'static,

Source§

fn hero_tag(self, tag: impl Into<String>) -> Hero<Self>

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<W> OverlayApi for W
where W: Widget + Send + Sync + 'static,

Source§

fn dropdown( self, open: Atom<bool>, content: impl Fn() -> BoxedWidget + Send + Sync + 'static, ) -> WithOverlay<Self>

Source§

fn sheet( self, open: Atom<bool>, content: impl Fn() -> BoxedWidget + Send + Sync + 'static, ) -> WithOverlay<Self>

Source§

fn dialog( self, open: Atom<bool>, content: impl Fn() -> BoxedWidget + Send + Sync + 'static, ) -> WithOverlay<Self>

Source§

fn rich_tooltip( self, content: impl Fn() -> BoxedWidget + Send + Sync + 'static, ) -> WithOverlay<Self>

Source§

fn toast( self, open: Atom<bool>, content: impl Fn() -> BoxedWidget + Send + Sync + 'static, ) -> WithOverlay<Self>

Source§

impl<W> PressApi for W
where W: Widget + Send + Sync + 'static,

Source§

fn on_press(self, f: impl Fn() + Send + Sync + 'static) -> Pressable<Self>

Source§

fn on_long_press( self, f: impl Fn() + Send + Sync + 'static, ) -> LongPressable<Self>

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<W> WidgetExt for W
where W: Widget + 'static,

Source§

fn tooltip(self, label: impl Into<String>) -> Tooltip

Show label while the pointer hovers this widget.