refactor: unify swipe reset to snap before clearing offset

Snap the Animatable first, clear rawOffset after - no frame with the
row still translated while the delete affordance is hidden.
This commit is contained in:
2026-09-04 02:05:59 +08:00
parent 1907e3004d
commit ccbd037507
@@ -111,8 +111,8 @@ fun DictionaryListItem(
snapshotFlow { isDeleteBlockedCurrent() } snapshotFlow { isDeleteBlockedCurrent() }
.collect { blocked -> .collect { blocked ->
if (blocked) { if (blocked) {
offsetAnim.snapTo(0f)
rawOffset = 0f rawOffset = 0f
scope.launch { offsetAnim.snapTo(0f) }
} }
} }
} }
@@ -271,8 +271,10 @@ fun DictionaryListItem(
onClick = { onClick = {
haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove) haptic.performHapticFeedback(HapticFeedbackType.TextHandleMove)
currentOnDelete() currentOnDelete()
scope.launch { offsetAnim.snapTo(0f) } scope.launch {
rawOffset = 0f offsetAnim.snapTo(0f)
rawOffset = 0f
}
}, },
modifier = Modifier modifier = Modifier
.align(Alignment.CenterEnd) .align(Alignment.CenterEnd)