Fix another BottomSheet regression (of #457e6712)

This commit is contained in:
vfsfitvnm
2022-07-26 15:14:44 +02:00
parent 1d259ebaa6
commit f86970e09a

View File

@@ -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 -> {
}
} }
} }