RowBlocks

class RowBlocks<T : Any>(val blockOf: (T) -> Any?, val onCommit: (RowBlockMove) -> Unit? = null, val blockHeader: @Composable context(RowBlockHeaderScope) (blockId: Any, rows: IntRange) -> Unit? = null, val onRowReorderWithinBlock: (RowWithinBlockMove) -> Unit? = null)

Row blocks: runs of adjacent rows that render and drag as one unit, declared by identity rather than by position — the library derives block extents from the same snapshot it renders, so they cannot go stale against an asynchronously filtered list. The consumer's data stays untouched during a gesture; the move arrives as one event at drop.

Passing a RowBlocks supersedes the per-row onRowMove: drag units are blocks, so every unit gesture reports through onCommit instead (a standalone move carries a null RowBlockMove.blockId). Dragging is split in two — the whole block moves from a handle in blockHeader, while each row moves within its own block from its cell handle.

Hold the instance in remember: it compares by identity, so a fresh instance per recomposition stops the table from skipping. A stable rowKey is required — move anchors are row keys.

Constructors

Link copied to clipboard
constructor(blockOf: (T) -> Any?, onCommit: (RowBlockMove) -> Unit? = null, blockHeader: @Composable context(RowBlockHeaderScope) (blockId: Any, rows: IntRange) -> Unit? = null, onRowReorderWithinBlock: (RowWithinBlockMove) -> Unit? = null)

Properties

Link copied to clipboard
val blockHeader: @Composable context(RowBlockHeaderScope) (blockId: Any, rows: IntRange) -> Unit?

Band content above a block; a draggableHandle() in its RowBlockHeaderScope drags the whole block. A block with no header cannot be dragged as a whole.

Link copied to clipboard
val blockOf: (T) -> Any?

Block identity; null = standalone row. Adjacent equal ids form one block.

Link copied to clipboard

One event per completed whole-block drag; null disables whole-block and standalone drag.

Link copied to clipboard

One event per within-block row reorder; null disables it. The row never leaves its block.