Remove dead code.

This commit is contained in:
Benoit Marty 2025-12-02 15:34:09 +01:00
parent f265a47243
commit b990f78bb8
2 changed files with 0 additions and 33 deletions

View file

@ -77,28 +77,9 @@ fun ExpandableBottomSheetLayout(
var calculatedMaxBottomContentHeightPx by remember(maxBottomContentHeightPx) { mutableIntStateOf(maxBottomContentHeightPx) }
val animatable = remember { Animatable(0f) }
fun calculatePercentage(currentPos: Int, minPos: Int, maxPos: Int): Float {
val currentProgress = currentPos - minPos
if (currentProgress < 0) {
Timber.e("Invalid current progress: $currentProgress, minPos: $minPos, maxPos: $maxPos")
return 0f
}
val total = (maxPos - minPos).toFloat()
if (total <= 0) {
Timber.e("Invalid total space: $total, minPos: $minPos, maxPos: $maxPos")
return 0f
}
return currentProgress / total
}
LaunchedEffect(animatable.value) {
if (animatable.isRunning && animatable.value != animatable.targetValue) {
currentBottomContentHeightPx = animatable.value.roundToInt()
state.internalDraggingPercentage = calculatePercentage(
currentPos = currentBottomContentHeightPx,
minPos = minBottomContentHeightPx,
maxPos = calculatedMaxBottomContentHeightPx,
)
}
}
@ -122,11 +103,6 @@ fun ExpandableBottomSheetLayout(
minBottomContentHeightPx -> ExpandableBottomSheetLayoutState.Position.COLLAPSED
else -> ExpandableBottomSheetLayoutState.Position.DRAGGING
}
state.internalDraggingPercentage = calculatePercentage(
currentPos = newHeight,
minPos = minBottomContentHeightPx,
maxPos = calculatedMaxBottomContentHeightPx,
)
currentBottomContentHeightPx = newHeight
},
onDragEnd = {

View file

@ -32,21 +32,12 @@ fun rememberExpandableBottomSheetLayoutState(): ExpandableBottomSheetLayoutState
@Stable
class ExpandableBottomSheetLayoutState {
internal var internalPosition: Position by mutableStateOf(Position.COLLAPSED)
internal var internalDraggingPercentage: Float by mutableFloatStateOf(
if (internalPosition == Position.EXPANDED) 1f else 0f
)
/**
* The current position of the bottom sheet layout.
*/
val position get() = internalPosition
/**
* The percentage of the bottom sheet layout that is currently being dragged.
* This value ranges from `0f` for [Position.COLLAPSED] to `1f` for [Position.EXPANDED].
*/
val draggingPercentage = internalDraggingPercentage
/**
* The position of the bottom sheet layout.
*/