Skip to content

Commit

Permalink
Use first and last detent when calculating Sheet's progress
Browse files Browse the repository at this point in the history
Fixes: #53
  • Loading branch information
alexstyl committed Feb 23, 2025
1 parent 1e79308 commit 1024c4d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions core/src/commonMain/kotlin/BottomSheet.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import androidx.compose.animation.rememberSplineBasedDecay
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.Indication
import androidx.compose.foundation.clickable
import androidx.compose.foundation.gestures.*
import androidx.compose.foundation.gestures.Orientation
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.*
import androidx.compose.runtime.*
Expand Down Expand Up @@ -192,7 +193,7 @@ public class BottomSheetState internal constructor(
}

public val progress: Float
get() = anchoredDraggableState.progress
get() = anchoredDraggableState.progress(detents.first(), detents.last())

public val offset: Float by derivedStateOf {
if (anchoredDraggableState.offset.isNaN() || closestDentToTop.isNaN()) {
Expand Down

0 comments on commit 1024c4d

Please sign in to comment.