ModalBottomSheetState
class ModalBottomSheetState : SwipeableState<ModalBottomSheetValue>
State of the ModalBottomSheetLayout composable.
Summary
Public methods |
suspend Unit |
Hide the bottom sheet with animation and suspend until it if fully hidden or animation has
been cancelled.
|
suspend Unit |
Show the bottom sheet with animation and suspend until it's shown.
|
Inherited functions |
From class SwipeableState
Unit |
animateTo(targetValue: T, anim: AnimationSpec<Float> = animationSpec)
Set the state to the target value by starting an animation.
|
Float |
performDrag(delta: Float)
Force swipeable to consume drag delta provided from outside of the regular swipeable
gesture flow.
Note: This method performs generic drag and it won't settle to any particular anchor, *
leaving swipeable in between anchors. When done dragging, performFling must be
called as well to ensure swipeable will settle at the anchor.
In general cases, swipeable drags by itself when being swiped. This method is to be
used for nested scroll logic that wraps the swipeable. In nested scroll developer may
want to force drag when the child scroll container reaches the bound.
|
Unit |
performFling(velocity: Float)
Perform fling with settling to one of the anchors which is determined by the given
velocity. Fling with settling swipeable will always consume all the velocity provided
since it will settle at the anchor.
In general cases, swipeable flings by itself when being swiped. This method is to be
used for nested scroll logic that wraps the swipeable. In nested scroll developer may
want to trigger settling fling when the child scroll container reaches the bound.
|
Unit |
snapTo(targetValue: T)
Set the state without any animation and suspend until it's set
|
|
Properties |
Boolean |
Whether the bottom sheet is visible.
|
Inherited properties |
From class SwipeableState
T |
currentValue
The current value of the state.
If no swipe or animation is in progress, this corresponds to the anchor at which the
swipeable is currently settled. If a swipe or animation is in progress, this corresponds
the last anchor at which the swipeable was settled before the swipe or animation started.
|
Float |
direction
The direction in which the swipeable is moving, relative to the current currentValue.
This will be either 1f if it is is moving from left to right or top to bottom, -1f if it is
moving from right to left or bottom to top, or 0f if no swipe or animation is in progress.
|
Boolean |
isAnimationRunning
Whether the state is currently animating.
|
State<Float> |
offset
The current position (in pixels) of the swipeable.
You should use this state to offset your content accordingly. The recommended way is to
use Modifier.offsetPx . This includes the resistance by default, if resistance i | |