Class BottomSheetState
-
- All Implemented Interfaces:
public final class BottomSheetState
State of the persistent bottom sheet in ScanbotScaffold.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
BottomSheetState.Companion
-
Field Summary
Fields Modifier and Type Field Description private final SwipeableV2State<BottomSheetValue>
swipeableState
private final BottomSheetValue
currentValue
private final Boolean
isExpanded
private final Boolean
isCollapsed
private final Float
progress
private final Float
offset
public final static BottomSheetState.Companion
Companion
-
Constructor Summary
Constructors Constructor Description BottomSheetState(BottomSheetValue initialValue, <Error class: unknown class><Float> animationSpec, Function1<BottomSheetValue, Boolean> confirmValueChange)
-
Method Summary
Modifier and Type Method Description final SwipeableV2State<BottomSheetValue>
getSwipeableState()
final BottomSheetValue
getCurrentValue()
final Boolean
isExpanded()
final Boolean
isCollapsed()
final Float
getProgress()
final Float
getOffset()
final Unit
expand()
Expand the bottom sheet with an animation and suspend until the animation finishes or is cancelled. final Unit
collapse()
Collapse the bottom sheet with animation and suspend until it if fully collapsed or animation has been cancelled. final Float
requireOffset()
Require the current offset. -
-
Constructor Detail
-
BottomSheetState
BottomSheetState(BottomSheetValue initialValue, <Error class: unknown class><Float> animationSpec, Function1<BottomSheetValue, Boolean> confirmValueChange)
- Parameters:
initialValue
- The initial value of the state.animationSpec
- The default animation that will be used to animate to a new state.confirmValueChange
- Optional callback invoked to confirm or veto a pending state change.
-
-
Method Detail
-
getSwipeableState
final SwipeableV2State<BottomSheetValue> getSwipeableState()
-
getCurrentValue
final BottomSheetValue getCurrentValue()
-
isExpanded
final Boolean isExpanded()
-
isCollapsed
final Boolean isCollapsed()
-
getProgress
final Float getProgress()
-
expand
final Unit expand()
Expand the bottom sheet with an animation and suspend until the animation finishes or is cancelled. Note: If the pick height is equal to the sheet height, this method will animate to the Collapsed state.
This method will throw CancellationException if the animation is interrupted.
-
collapse
final Unit collapse()
Collapse the bottom sheet with animation and suspend until it if fully collapsed or animation has been cancelled. This method will throw CancellationException if the animation is interrupted.
-
requireOffset
final Float requireOffset()
Require the current offset.
-
-
-
-