startItemDragReorder method
void
startItemDragReorder({
- required int index,
- required PointerDownEvent event,
- required MultiDragGestureRecognizer recognizer,
Initiate the dragging of the item at index
that was started with
the pointer down event
.
The given recognizer
will be used to recognize and start the drag
item tracking and lead to either an item reorder, or a cancelled drag.
Most applications will not use this directly, but will wrap the item (or part of the item, like a drag handle) in either a ReorderableGridDragStartListener or ReorderableGridDelayedDragStartListener which call this method when they detect the gesture that triggers a drag start.
Implementation
void startItemDragReorder({
required int index,
required PointerDownEvent event,
required MultiDragGestureRecognizer recognizer,
}) {
assert(0 <= index && index < widget.itemCount);
setState(() {
if (_dragInfo != null) {
cancelReorder();
}
if (_items.containsKey(index)) {
_dragIndex = index;
_recognizer = recognizer
..onStart = _dragStart
..addPointer(event);
} else {
throw Exception('Attempting to start a drag on a non-visible item');
}
});
}