admin管理员组

文章数量:1277293

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.

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.

Share Improve this question asked Feb 24 at 6:21 Santhosh KumarSanthosh Kumar 5391 silver badge11 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

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.

本文标签: