pub struct BottomSheetState { /* private fields */ }Expand description
Retained position, available stops and transitions of a bottom sheet.
Implementations§
Source§impl BottomSheetState
impl BottomSheetState
Sourcepub fn new(initial: BottomSheetValue, cx: &mut Context<'_, Self>) -> Self
pub fn new(initial: BottomSheetValue, cx: &mut Context<'_, Self>) -> Self
Creates retained bottom-sheet state starting at the given settled stop.
Sourcepub fn enabled_values(
self,
values: impl IntoIterator<Item = BottomSheetValue>,
) -> Self
pub fn enabled_values( self, values: impl IntoIterator<Item = BottomSheetValue>, ) -> Self
Configures available stops. An empty set retains the initial stop.
Sourcepub fn confirm_value_change(
self,
confirm: impl Fn(BottomSheetValue) -> bool + 'static,
) -> Self
pub fn confirm_value_change( self, confirm: impl Fn(BottomSheetValue) -> bool + 'static, ) -> Self
Vetoes a requested destination before it changes visibility or focus.
Sourcepub fn available_values(&self) -> &[BottomSheetValue]
pub fn available_values(&self) -> &[BottomSheetValue]
Returns the enabled stops in ascending height order.
Sourcepub fn current_value(&self) -> BottomSheetValue
pub fn current_value(&self) -> BottomSheetValue
Returns the last settled stop.
Sourcepub fn target_value(&self) -> BottomSheetValue
pub fn target_value(&self) -> BottomSheetValue
Returns the stop the sheet is currently settled at or transitioning toward.
Sourcepub fn is_animating(&self) -> bool
pub fn is_animating(&self) -> bool
Returns whether the sheet is currently animating toward its target stop.
Sourcepub fn visible_height(&self) -> Pixels
pub fn visible_height(&self) -> Pixels
Returns the sheet’s current visible height in logical pixels.
Sourcepub fn show(&mut self, window: &mut Window, cx: &mut Context<'_, Self>) -> bool
pub fn show(&mut self, window: &mut Window, cx: &mut Context<'_, Self>) -> bool
Animates the sheet to BottomSheetValue::PartiallyExpanded if enabled, or BottomSheetValue::Expanded otherwise.
Returns false if the target stop is unavailable or vetoed.
Sourcepub fn expand(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> bool
pub fn expand( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool
Animates the sheet to BottomSheetValue::Expanded. Returns false if unavailable or vetoed.
Sourcepub fn partial_expand(
&mut self,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> bool
pub fn partial_expand( &mut self, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool
Animates the sheet to BottomSheetValue::PartiallyExpanded. Returns false if unavailable or vetoed.
Sourcepub fn hide(&mut self, window: &mut Window, cx: &mut Context<'_, Self>) -> bool
pub fn hide(&mut self, window: &mut Window, cx: &mut Context<'_, Self>) -> bool
Animates the sheet to BottomSheetValue::Hidden. Returns false if unavailable or vetoed.
Sourcepub fn animate_to(
&mut self,
value: BottomSheetValue,
window: &mut Window,
cx: &mut Context<'_, Self>,
) -> bool
pub fn animate_to( &mut self, value: BottomSheetValue, window: &mut Window, cx: &mut Context<'_, Self>, ) -> bool
Animates the sheet to value, respecting reduced-motion settings. Returns false if unavailable or vetoed.
Auto Trait Implementations§
impl !RefUnwindSafe for BottomSheetState
impl !Send for BottomSheetState
impl !Sync for BottomSheetState
impl !UnwindSafe for BottomSheetState
impl Forget for BottomSheetState
impl Freeze for BottomSheetState
impl Move for BottomSheetState
impl Unpin for BottomSheetState
impl UnsafeUnpin for BottomSheetState
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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