diff --git a/README.md b/README.md index a3c8c79..dca89d2 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample1.kt b/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample1.kt index a36d8b8..cd97512 100644 --- a/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample1.kt +++ b/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample1.kt @@ -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 @@ -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( diff --git a/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample2.kt b/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample2.kt index 7b73322..4251719 100644 --- a/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample2.kt +++ b/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample2.kt @@ -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 diff --git a/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample3.kt b/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample3.kt index 0d7204d..8231eda 100644 --- a/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample3.kt +++ b/app/src/main/kotlin/com/skydoves/flexiblebottomsheetdemo/FlexibleBottomSheetSample3.kt @@ -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 diff --git a/flexible-core/src/commonMain/kotlin/com/skydoves/flexible/core/FlexibleSheetState.kt b/flexible-core/src/commonMain/kotlin/com/skydoves/flexible/core/FlexibleSheetState.kt index 9ecad8b..f9cc4d3 100644 --- a/flexible-core/src/commonMain/kotlin/com/skydoves/flexible/core/FlexibleSheetState.kt +++ b/flexible-core/src/commonMain/kotlin/com/skydoves/flexible/core/FlexibleSheetState.kt @@ -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, @@ -46,7 +47,6 @@ 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 @@ -54,7 +54,7 @@ import kotlin.jvm.JvmName */ @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, @@ -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, @@ -481,6 +482,7 @@ public fun rememberFlexibleBottomSheetState( @Composable private fun rememberFlexibleSheetState( + skipHiddenState: Boolean = false, skipIntermediatelyExpanded: Boolean = false, skipSlightlyExpanded: Boolean = false, isModal: Boolean = true, @@ -490,7 +492,6 @@ private fun rememberFlexibleSheetState( flexibleSheetSize: FlexibleSheetSize = FlexibleSheetSize(), containSystemBars: Boolean = false, allowNestedScroll: Boolean = true, - skipHiddenState: Boolean = false, ): FlexibleSheetState { return rememberSaveable( skipHiddenState,