I'm using Jetpack Compose and working with BottomSheetScaffold. I'm trying to understand the difference between various states like:
1.Showing the bottom sheet
2.Expanding the bottom sheet
3.Partially expanding the bottom sheet
4.Hiding the bottom sheet
I am confusing show() and expand() and partiallyExpand() in material 3.
Please make yourself familiar with the official documentation of Material3, there you can find the SheetState
class:
suspend fun expand(): Unit
[...] fully expand the bottom sheet with animation and suspend until it is fully expanded or animation has been cancelled.
suspend fun show(): Unit
[...] expand the bottom sheet with animation and suspend until it is PartiallyExpanded if defined, else Expanded.
So expand
opens the BottomSheet fully, while show
opens it only until PartiallExpanded
if that is enabled for the BottomSheet.
val bottomSheetState = rememberBottomSheetScaffoldState(
SheetState(skipPartiallyExpanded = true)
)
In above code sample, both would behave the same way.