@@ -53,9 +53,8 @@ import kotlin.math.min
5353 *
5454 * @param state The bottom sheet state. Call [rememberBottomSheetState] to create one.
5555 * @param modifier Modifier for bottom sheet content.
56- * @param peekHeight Peek height, could be a dp, px, or fraction value. To skip the peek state,
57- * set the peek height to a value at least equal to the content height, e.g, PeekHeight.fraction(1f),
58- * PeekHeight.px(Int.MAX_VALUE). Defaults to PeekHeight.fraction(0.5f).
56+ * @param skipPeek Skip the peek state if set to true. Defaults to false.
57+ * @param peekHeight Peek height, could be a dp, px, or fraction value.
5958 * @param backgroundColor Background color for sheet content.
6059 * @param dimColor Dim color. Defaults to [Color.Black].
6160 * @param maxDimAmount Maximum dim amount. Defaults to 0.45f.
@@ -67,6 +66,7 @@ import kotlin.math.min
6766fun BottomSheet (
6867 state : BottomSheetState ,
6968 modifier : Modifier = Modifier ,
69+ skipPeek : Boolean = false,
7070 peekHeight : PeekHeight = PeekHeight .fraction(0.5f),
7171 shape : Shape = MaterialTheme .shapes.medium.copy(
7272 bottomStart = CornerSize (0.dp),
@@ -87,6 +87,7 @@ fun BottomSheet(
8787 val scope = rememberCoroutineScope()
8888
8989 val currentState by rememberUpdatedState(state)
90+ val currentSkipPeek by rememberUpdatedState(skipPeek)
9091 val currentPeekHeight by rememberUpdatedState(peekHeight)
9192 val currentShape by rememberUpdatedState(shape)
9293 val currentBackgroundColor by rememberUpdatedState(backgroundColor)
@@ -120,6 +121,7 @@ fun BottomSheet(
120121 BottomSheetLayout (
121122 state = currentState,
122123 modifier = modifier,
124+ skipPeek = currentSkipPeek,
123125 peekHeight = currentPeekHeight,
124126 shape = currentShape,
125127 backgroundColor = currentBackgroundColor,
@@ -156,6 +158,7 @@ fun BottomSheet(
156158fun BottomSheetLayout (
157159 state : BottomSheetState ,
158160 modifier : Modifier = Modifier ,
161+ skipPeek : Boolean = false,
159162 peekHeight : PeekHeight = PeekHeight .fraction(0.5f),
160163 shape : Shape = MaterialTheme .shapes.medium.copy(
161164 bottomStart = CornerSize (0.dp),
@@ -184,6 +187,7 @@ fun BottomSheetLayout(
184187
185188 SideEffect {
186189 state.peekHeight = peekHeight
190+ state.forceSkipPeek = skipPeek
187191 state.maxDimAmount = maxDimAmount
188192 }
189193
0 commit comments