fix(alarms): keep a settling card from overshooting past its rest
This commit is contained in:
@@ -75,7 +75,8 @@ internal fun SwipeToDelete(
|
||||
val flingVelocity = with(LocalDensity.current) { FlingVelocity.toPx() }
|
||||
|
||||
// How far the card has travelled towards the end edge: 0 at rest, never negative.
|
||||
val travel = remember { Animatable(0f) }
|
||||
// Bounded below, so the settle spring cannot overshoot the card past its rest.
|
||||
val travel = remember { Animatable(0f).apply { updateBounds(lowerBound = 0f) } }
|
||||
var width by remember { mutableIntStateOf(0) }
|
||||
// Derived, so a drag recomposes this once as the red appears, not per frame.
|
||||
val revealed by remember { derivedStateOf { travel.value > 0f } }
|
||||
|
||||
Reference in New Issue
Block a user