lazy-list-drag-reorder

Installation
SKILL.md

Drag-to-reorder in a lazy list

Three pieces, and the split matters: a state holder owning the drag, a per-item wrapper that decides how each row animates, and one gesture detector on the list — not on each row. A lazy list discards rows, so a per-row detector dies mid-drag; the list-level one hit-tests instead:

// adapted — on drag start, find which laid-out row the finger came down on
state.layoutInfo.visibleItemsInfo
    .firstOrNull { offset.y.toInt() in it.offset..(it.offset + it.size) }
    ?.also { currentIndex = it.index; initialElement = it; initialOffset = it.offset }

The lifted row's translation is recomputed every frame against its current laid-out offset, never accumulated blindly:

Installs
2
GitHub Stars
35
First Seen
6 days ago
lazy-list-drag-reorder — maxrave-dev/kotlin-footguns