fix(radar): SwipeDeleteRow 倒计时期间重新拖拽后归零偏移
问题:倒计时期间重新拖拽会取消 pending(正确),但 offsetX 仍是负值,行卡在滑开状态(要继续滑才能归位)。 根因:onDragStart 里只取消了 pending,没有归零 offsetX。 修复:onDragStart 取消 pending 的同时归零 offsetX。 影响:拖拽取消后行立即回到正常位置。
This commit is contained in:
1 parent
aac3aee4bb
commit
aa10d4170c
1 file changed
+6
-1
@@ -465,7 +465,12 @@ internal fun SwipeDeleteRow(
|
||||
.background(MaterialTheme.colorScheme.surfaceContainer)
|
||||
.pointerInput(Unit) {
|
||||
detectHorizontalDragGestures(
|
||||
onDragStart = { if (pending) { pending = false } },
|
||||
onDragStart = {
|
||||
if (pending) {
|
||||
pending = false
|
||||
offsetX = 0f
|
||||
}
|
||||
},
|
||||
onHorizontalDrag = { change, dragAmount ->
|
||||
change.consume()
|
||||
offsetX = (offsetX + dragAmount).coerceIn(-rowWidth.toFloat(), 0f)
|
||||
|
||||
Reference in new issue
Block a user