Skip to content

Commit

Permalink
Update docs for skipHiddenState
Browse files Browse the repository at this point in the history
  • Loading branch information
skydoves committed Jun 6, 2024
1 parent d3cde88 commit 8f780bb
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ The flexible bottom sheet offers four primary sheet statuses known as `FlexibleV
- **Fully Expanded**: The sheet is visible at its fully-expanded height. This is mandatory and cannot be skipped.
- **Intermediately Expanded**: The sheet is visible at an intermediate expanded height. This can be skipped by setting `skipIntermediatelyExpanded` to `true`.
- **Slightly Expanded**: The sheet is visible at a slightly expanded height. This is skipped by default but can be enabled by setting `skipSlightlyExpanded` to `false`.
- **Hidden**: The sheet is completely not visible on the screen.
- **Hidden**: The sheet is completely not visible on the screen. If you never want to dismiss and keep displaying the bottom sheet, you can give `skipHiddenState` to `true`.

You have the option to skip the **Intermediately Expanded** and **Slightly Expanded** states, as demonstrated below:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ package com.skydoves.flexiblebottomsheetdemo

import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand All @@ -42,7 +42,7 @@ fun FlexibleBottomSheetSample1(
var currentSheetTarget by remember { mutableStateOf(FlexibleSheetValue.IntermediatelyExpanded) }
val systemUiController = rememberSystemUiController()

val primaryColor = MaterialTheme.colors.primary
val primaryColor = MaterialTheme.colorScheme.primary
val scrimColor = Color.Black.copy(alpha = 0.65f)

FlexibleBottomSheet(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
import androidx.compose.foundation.lazy.grid.items
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Text
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.Text
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import kotlin.jvm.JvmName
*
* Contains states relating to it's swipe position as well as animations between state values.
*
* @param skipHiddenState Whether the hidden state should be skipped. If true, the sheet will always be displayed.
* @param skipIntermediatelyExpanded Whether the intermediately expanded state, if the sheet is large
* enough, should be skipped. If true, the sheet will always expand to the [FlexibleSheetValue.FullyExpanded] state and move
* @param skipSlightlyExpanded Whether the slightly expanded state, if the sheet is tall enough,
Expand All @@ -46,15 +47,14 @@ import kotlin.jvm.JvmName
* @param flexibleSheetSize FlexibleSheetSize constraints the content size of [FlexibleBottomSheet] based on its states.
* @param initialValue The initial value of the state.
* @param confirmValueChange Optional callback invoked to confirm or veto a pending state change.
* @param skipHiddenState Whether the hidden state should be skipped. If true, the sheet will always
* @param isModal Determines if the bottom sheet should be modal. If set to true, the sheet will include a scrim overlaying the background and
* will be dismissed upon touching outside of the sheet. If set to false, the bottom sheet allows interaction with the screen, permitting actions outside of the sheet.
* expand to the [FlexibleSheetValue.FullyExpanded] state and move to the [FlexibleSheetValue.IntermediatelyExpanded] if available, either
* programmatically or by user interaction.
*/
@Stable
public class FlexibleSheetState(
public val skipHiddenState: Boolean = false,
public val skipHiddenState: Boolean,
public val skipIntermediatelyExpanded: Boolean,
public val skipSlightlyExpanded: Boolean,
public val flexibleSheetSize: FlexibleSheetSize,
Expand Down Expand Up @@ -438,6 +438,7 @@ public fun consumeSwipeWithinBottomSheetBoundsNestedScrollConnection(
/**
* Create and [remember] a [FlexibleSheetState] for [FlexibleBottomSheet].
*
* @param skipHiddenState Whether the hidden state should be skipped. If true, the sheet will always be displayed.
* @param skipIntermediatelyExpanded Whether the intermediately expanded state, if the sheet is tall enough,
* should be skipped. If true, the sheet will always expand to the [FlexibleSheetValue.FullyExpanded] state and move to the
* @param skipSlightlyExpanded Whether the slightly expanded state, if the sheet is tall enough,
Expand Down Expand Up @@ -481,6 +482,7 @@ public fun rememberFlexibleBottomSheetState(

@Composable
private fun rememberFlexibleSheetState(
skipHiddenState: Boolean = false,
skipIntermediatelyExpanded: Boolean = false,
skipSlightlyExpanded: Boolean = false,
isModal: Boolean = true,
Expand All @@ -490,7 +492,6 @@ private fun rememberFlexibleSheetState(
flexibleSheetSize: FlexibleSheetSize = FlexibleSheetSize(),
containSystemBars: Boolean = false,
allowNestedScroll: Boolean = true,
skipHiddenState: Boolean = false,
): FlexibleSheetState {
return rememberSaveable(
skipHiddenState,
Expand Down

0 comments on commit 8f780bb

Please # to comment.