Fix another BottomSheet regression (of #457e6712)
This commit is contained in:
@@ -82,10 +82,10 @@ fun BottomSheet(
|
|||||||
state.snapTo(initialValue)
|
state.snapTo(initialValue)
|
||||||
},
|
},
|
||||||
onDragEnd = {
|
onDragEnd = {
|
||||||
val velocity = velocityTracker.calculateVelocity().y.absoluteValue
|
val velocity = velocityTracker.calculateVelocity().y
|
||||||
velocityTracker.resetTracking()
|
velocityTracker.resetTracking()
|
||||||
|
|
||||||
if (velocity.absoluteValue > 300 && initialValue != state.value) {
|
if (velocity.absoluteValue > 250 && initialValue != state.value) {
|
||||||
when (initialValue) {
|
when (initialValue) {
|
||||||
state.expandedBound -> state.collapse()
|
state.expandedBound -> state.collapse()
|
||||||
state.collapsedBound -> if (initialValue > state.value && onDismiss != null) {
|
state.collapsedBound -> if (initialValue > state.value && onDismiss != null) {
|
||||||
@@ -94,6 +94,7 @@ fun BottomSheet(
|
|||||||
} else {
|
} else {
|
||||||
state.expand()
|
state.expand()
|
||||||
}
|
}
|
||||||
|
else -> state.expand()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val l0 = state.dismissedBound
|
val l0 = state.dismissedBound
|
||||||
@@ -112,7 +113,9 @@ fun BottomSheet(
|
|||||||
}
|
}
|
||||||
in l1..l2 -> state.collapse()
|
in l1..l2 -> state.collapse()
|
||||||
in l2..l3 -> state.expand()
|
in l2..l3 -> state.expand()
|
||||||
else -> {}
|
else -> {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,8 +307,8 @@ fun rememberBottomSheetState(
|
|||||||
}
|
}
|
||||||
|
|
||||||
val animatable = Animatable(initialValue, Dp.VectorConverter).also {
|
val animatable = Animatable(initialValue, Dp.VectorConverter).also {
|
||||||
it.updateBounds(dismissedBound.coerceAtMost(expandedBound), expandedBound)
|
it.updateBounds(dismissedBound.coerceAtMost(expandedBound), expandedBound)
|
||||||
}
|
}
|
||||||
|
|
||||||
BottomSheetState(
|
BottomSheetState(
|
||||||
draggableState = DraggableState { delta ->
|
draggableState = DraggableState { delta ->
|
||||||
|
|||||||
Reference in New Issue
Block a user