ReorderableNodeWrapper typedef

ReorderableNodeWrapper = Widget Function({required Widget child, Widget? handle, bool longPressToDrag})

Signature of the wrap callback passed to SliverReorderableTree.nodeBuilder.

Returns a widget that wraps child with drag behavior. Exactly one of handle or longPressToDrag must be chosen:

  • Provide a handle widget (e.g. Icon(Icons.drag_indicator)) to restrict drag initiation to that handle. Recommended for desktop.
  • Pass longPressToDrag: true to start the drag after a long press anywhere on the row. Recommended for mobile.

If both handle is non-null and longPressToDrag is true, handle wins and the long-press is ignored.

Implementation

typedef ReorderableNodeWrapper =
    Widget Function({
      required Widget child,
      Widget? handle,
      bool longPressToDrag,
    });