pub struct MaterialBottomSheet { /* private fields */ }Expand description
An M3 bottom sheet. Standard sheets dock to their parent’s bottom edge and leave the content interactive; modal ones present over the window. Dragging the sheet down past its nearest rest dismisses it; otherwise it snaps to the expanded or partial detent.
Implementations§
Source§impl MaterialBottomSheet
impl MaterialBottomSheet
pub fn new(id: impl Into<ElementId>) -> Self
Sourcepub fn open(self, open: bool) -> Self
pub fn open(self, open: bool) -> Self
Present the sheet while open. Without it the sheet renders in place
(a specimen).
Sourcepub fn detent(self, detent: BottomSheetDetent) -> Self
pub fn detent(self, detent: BottomSheetDetent) -> Self
Present the sheet at detent (controlled): hidden closes it, and a
change moves it to the partial or expanded detent. Report the
person’s changes with Self::on_detent_change.
Sourcepub fn on_detent_change(
self,
f: impl Fn(BottomSheetDetent, &mut Window, &mut App) + 'static,
) -> Self
pub fn on_detent_change( self, f: impl Fn(BottomSheetDetent, &mut Window, &mut App) + 'static, ) -> Self
Called with the detent a drag, the handle or a dismissal moves the sheet to.
pub fn modal(self, modal: bool) -> Self
Sourcepub fn contained(self, contained: bool) -> Self
pub fn contained(self, contained: bool) -> Self
Present the modal sheet over its positioned parent’s bounds instead of the whole window.
Sourcepub fn dismiss_on_scrim(self, dismiss: bool) -> Self
pub fn dismiss_on_scrim(self, dismiss: bool) -> Self
Whether pressing the modal sheet’s scrim dismisses it (default true).
Sourcepub fn dismiss_on_escape(self, dismiss: bool) -> Self
pub fn dismiss_on_escape(self, dismiss: bool) -> Self
Whether Escape dismisses the modal sheet (default true).
Sourcepub fn drag_handle(self, label: impl Into<SharedString>) -> Self
pub fn drag_handle(self, label: impl Into<SharedString>) -> Self
Show the drag handle; label is its accessible name. Activating it
toggles between the partial and expanded detents.
Sourcepub fn partial_height(self, height: Rems) -> Self
pub fn partial_height(self, height: Rems) -> Self
A partially expanded detent showing height of the sheet; the sheet
opens there and expands when dragged up.
Sourcepub fn on_dismiss(self, f: impl Fn(&mut Window, &mut App) + 'static) -> Self
pub fn on_dismiss(self, f: impl Fn(&mut Window, &mut App) + 'static) -> Self
Called when a drag, Escape or the scrim dismisses the sheet.
Trait Implementations§
Source§impl IntoElement for MaterialBottomSheet
impl IntoElement for MaterialBottomSheet
Source§type Element = ViewElement<MaterialBottomSheet>
type Element = ViewElement<MaterialBottomSheet>
Source§fn into_element(self) -> Self::Element
fn into_element(self) -> Self::Element
Element].Source§fn into_any_element(self) -> AnyElement
fn into_any_element(self) -> AnyElement
AnyElement].Source§impl ParentElement for MaterialBottomSheet
impl ParentElement for MaterialBottomSheet
Source§fn extend(&mut self, children: impl IntoIterator<Item = AnyElement>)
fn extend(&mut self, children: impl IntoIterator<Item = AnyElement>)
§fn child(self, child: impl IntoElement) -> Selfwhere
Self: Sized,
fn child(self, child: impl IntoElement) -> Selfwhere
Self: Sized,
§fn children(self, children: impl IntoIterator<Item = impl IntoElement>) -> Selfwhere
Self: Sized,
fn children(self, children: impl IntoIterator<Item = impl IntoElement>) -> Selfwhere
Self: Sized,
Auto Trait Implementations§
impl !RefUnwindSafe for MaterialBottomSheet
impl !Send for MaterialBottomSheet
impl !Sync for MaterialBottomSheet
impl !UnwindSafe for MaterialBottomSheet
impl Freeze for MaterialBottomSheet
impl Unpin for MaterialBottomSheet
impl UnsafeUnpin for MaterialBottomSheet
Blanket Implementations§
§impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
impl<E> AnimationExt for Ewhere
E: IntoElement + 'static,
§fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animation(
self,
id: impl Into<ElementId>,
animation: Animation,
animator: impl Fn(Self, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
fn with_animations(
self,
id: impl Into<ElementId>,
animations: Vec<Animation>,
animator: impl Fn(Self, usize, f32) -> Self + 'static,
) -> AnimationElement<Self>where
Self: Sized,
§fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
fn with_spring<T>(
self,
id: impl Into<ElementId>,
animation: SpringAnimation<T>,
animator: impl FnOnce(Self, <T as SpringTarget>::Output) -> Self + 'static,
) -> SpringAnimationElement<Self>where
Self: Sized,
T: SpringTarget,
<T as SpringTarget>::Output: 'static,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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
§impl<T> ElementExt for Twhere
T: ParentElement,
impl<T> ElementExt for Twhere
T: ParentElement,
§fn text_selection_scope(self, scope: TextSelectionScopeId) -> impl IntoElementwhere
Self: IntoElement,
fn text_selection_scope(self, scope: TextSelectionScopeId) -> impl IntoElementwhere
Self: IntoElement,
§fn on_prepaint<F>(self, callback: F) -> Selfwhere
F: FnOnce(Bounds<Pixels>, &mut Window, &mut App) + 'static,
fn on_prepaint<F>(self, callback: F) -> Selfwhere
F: FnOnce(Bounds<Pixels>, &mut Window, &mut App) + 'static,
callback during prepaint with this element’s resolved bounds.§impl<T> FluentBuilder for Twhere
T: IntoElement,
impl<T> FluentBuilder for Twhere
T: IntoElement,
§fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
fn map<U>(self, f: impl FnOnce(Self) -> U) -> Uwhere
Self: Sized,
§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Selfwhere
Self: Sized,
§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Selfwhere
Self: Sized,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
§impl<E> TestTextExt for Ewhere
E: IntoElement,
impl<E> TestTextExt for Ewhere
E: IntoElement,
§fn test_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_text(self, text: impl Into<SharedString>) -> Self::Element
test-support, records text each time the element paints.
Otherwise returns the element it builds.§fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
fn test_alt_text(self, text: impl Into<SharedString>) -> Self::Element
Self::test_text] for an image’s alternative text, which
stands in for what the element draws.