dragToReorder

fun <T> Modifier.dragToReorder(item: T, itemList: List<T>, itemHeight: Int, updateSlideState: (item: T, slideState: SlideState) -> Unit, onStartDrag: (currIndex: Int) -> Unit = {}, onDrag: (dy: Float, currIndex: Int, destIndex: Int) -> Unit = { _, _, _ -> }, onStopDrag: (currIndex: Int, destIndex: Int) -> Unit): Modifier

Adds a drag-to-reorder functionality to the given modifier.

Return

A modifier that adds drag-to-reorder functionality.

Parameters

item

The item to be dragged.

itemList

The list of items to which the item belongs.

itemHeight

The height of each item in the list in pixels.

updateSlideState

A callback function to update the slide state of an item.

onStartDrag

A callback function to be invoked when the drag operation starts and provides the starting index.

onDrag

A callback function to be invoked during the dragging operation

onStopDrag

A callback function to be invoked when the drag operation ends.