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: boolImplementations§
Source§impl Sheet
impl Sheet
pub fn new(child: impl Widget + 'static) -> Self
pub fn radius(self, r: f32) -> Self
pub fn padding(self, p: EdgeInsets) -> Self
pub fn no_handle(self) -> Self
Sourcepub fn height(self, h: f32) -> Self
pub fn height(self, h: f32) -> Self
A fixed sheet height in logical pixels (capped at the window height).
Sourcepub fn detent(self, fraction: f32) -> Self
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.
Sourcepub fn full_screen(self) -> Self
pub fn full_screen(self) -> Self
Take the full available height — the full-screen presentation (still bottom-anchored, still rounded at the top).
Sourcepub fn background(self, c: Color) -> Self
pub fn background(self, c: Color) -> Self
Sheet fill — defaults to the theme’s surface.
Sourcepub fn handle_color(self, c: Color) -> Self
pub fn handle_color(self, c: Color) -> Self
Grab-handle color — defaults to the theme’s outline.
Sourcepub fn material(self, m: ShaderMaterial) -> Self
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).
Sourcepub fn scrollable(self) -> Self
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.
Sourcepub fn scrollable_with(self, controller: ScrollController) -> Self
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
impl Widget for Sheet
Source§fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
fn layout(&self, ctx: &LayoutCtx<'_>) -> Size
ctx.constraints and return a size within them. Read more