setReorderPreview method
void
setReorderPreview({})
Opens the make-room preview at one of targetKey's own row edges:
gapBelowTarget: false for the edge above it, true for the edge
directly below it.
A convenience over setReorderPreviewAtIndex for callers that genuinely mean "at this row", which is how previews are most naturally expressed in tests. Drop resolution must NOT use it: a resolved slot is not always adjacent to the hovered row, and deriving the gap from the row is exactly how a previewed gap and a committed position come to disagree. Pass TreeDropTarget.gapVisibleIndex to setReorderPreviewAtIndex instead.
Implementation
void setReorderPreview({
required TKey draggedKey,
required TKey targetKey,
required bool gapBelowTarget,
Duration? duration,
Curve? curve,
}) {
final targetIndex = getVisibleIndex(targetKey);
if (targetIndex < 0) {
clearReorderPreview(animate: false);
return;
}
setReorderPreviewAtIndex(
draggedKey: draggedKey,
gapVisibleIndex: gapBelowTarget ? targetIndex + 1 : targetIndex,
duration: duration,
curve: curve,
);
}