Skip to main content

ShowBottomSheet

Struct ShowBottomSheet 

Source
pub struct ShowBottomSheet { /* private fields */ }
Expand description

Shows a Material Design bottom sheet in the nearest Scaffold ancestor. To show a persistent bottom sheet, use the Scaffold::bottom_sheet.

Returns a controller that can be used to close and otherwise manipulate the bottom sheet.

The optional background_color, elevation, shape, clip_behavior, constraints and transition_animation_controller parameters can be passed in to customize the appearance and behavior of persistent bottom sheets (see the documentation for these on BottomSheet for more details).

The enable_drag parameter specifies whether the bottom sheet can be dragged up and down and dismissed by swiping downwards.

The sheet_animation_style parameter is used to override the bottom sheet animation duration and reverse animation duration.

If AnimationStyle.duration is provided, it will be used to override the bottom sheet animation duration in the underlying BottomSheet::create_animation_controller.

If AnimationStyle.reverseDuration is provided, it will be used to override the bottom sheet reverse animation duration in the underlying BottomSheet::create_animation_controller.

To disable the bottom sheet animation, use AnimationStyle.noAnimation.

To rebuild the bottom sheet (e.g. if it is stateful), call PersistentBottomSheetController::set_state on the controller returned by this method.

The new bottom sheet becomes a LocalHistoryEntry for the enclosing ModalRoute and a back button is added to the app bar of the Scaffold that closes the bottom sheet.

To create a persistent bottom sheet that is not a LocalHistoryEntry and does not add a back button to the enclosing Scaffold’s app bar, use the Scaffold::bottom_sheet constructor parameter.

A closely related widget is a modal bottom sheet, which is an alternative to a menu or a dialog and prevents the user from interacting with the rest of the app. Modal bottom sheets can be created and displayed with the ShowModalBottomSheet function.

The context argument is used to look up the Scaffold for the bottom sheet. It is only used when the method is called. Its corresponding widget can be safely removed from the tree before the bottom sheet is closed.

See also:

Implementations§

Source§

impl ShowBottomSheet

Source

pub fn new(builder: WidgetBuilder) -> ShowBottomSheet

Creates a builder for a persistent bottom sheet; Dart’s showBottomSheet required argument is the builder, and every other argument is a setter.

Source

pub fn background_color(self, background_color: Color) -> ShowBottomSheet

The background color of the sheet.

Source

pub fn elevation(self, elevation: f64) -> ShowBottomSheet

The z-coordinate of the sheet.

Source

pub fn shape(self, shape: impl Into<ShapeBorderRef>) -> ShowBottomSheet

The shape of the sheet’s material.

Source

pub fn clip_behavior(self, clip_behavior: Clip) -> ShowBottomSheet

The clip behavior of the sheet.

Source

pub fn constraints(self, constraints: BoxConstraints) -> ShowBottomSheet

The size constraints on the sheet.

Source

pub fn enable_drag(self, enable_drag: bool) -> ShowBottomSheet

Whether the sheet can be dragged up and down.

Source

pub fn show_drag_handle(self, show_drag_handle: bool) -> ShowBottomSheet

Whether the sheet shows a drag handle.

Source

pub fn transition_animation_controller( self, transition_animation_controller: Ref<AnimationController>, ) -> ShowBottomSheet

An animation controller the sheet uses instead of creating one.

Source

pub fn sheet_animation_style( self, sheet_animation_style: AnimationStyle, ) -> ShowBottomSheet

An animation style that overrides the sheet’s animation durations.

Source

pub fn show( self, app: &mut App, context: BuildContext, ) -> Rc<PersistentBottomSheetController>

Shows the sheet and returns its controller.

Auto Trait Implementations§

§

impl !RefUnwindSafe for ShowBottomSheet

§

impl !Send for ShowBottomSheet

§

impl !Sync for ShowBottomSheet

§

impl !UnwindSafe for ShowBottomSheet

§

impl Forget for ShowBottomSheet

§

impl Freeze for ShowBottomSheet
where *const RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>> is !null: Freeze, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>>: Freeze, *const RcInner<dyn ShapeBorder> is !null: Freeze, PhantomData<RcInner<dyn ShapeBorder>>: Freeze, NonZero<u32>: Freeze, PhantomData<fn() -> AnimationController>: Freeze, *const RcInner<Keep> is !null: Freeze, PhantomData<RcInner<Keep>>: Freeze, *const RcInner<dyn Curve> is !null: Freeze, PhantomData<RcInner<dyn Curve>>: Freeze,

§

impl Move for ShowBottomSheet

§

impl Unpin for ShowBottomSheet
where Rc<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>: Unpin, Rc<dyn ShapeBorder>: Unpin, NonZero<u32>: Unpin, Rc<Keep>: Unpin, Rc<dyn Curve>: Unpin,

§

impl UnsafeUnpin for ShowBottomSheet
where *const RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Fn(&mut App, AnyElement) -> Rc<dyn Widget>>>: UnsafeUnpin, *const RcInner<dyn ShapeBorder> is !null: UnsafeUnpin, PhantomData<RcInner<dyn ShapeBorder>>: UnsafeUnpin, NonZeroU32Inner: UnsafeUnpin, PhantomData<fn() -> AnimationController>: UnsafeUnpin, *const RcInner<Keep> is !null: UnsafeUnpin, PhantomData<RcInner<Keep>>: UnsafeUnpin, *const RcInner<dyn Curve> is !null: UnsafeUnpin, PhantomData<RcInner<dyn Curve>>: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>