TreeReorderConfig<TKey> class

Everything a declarative tree needs to support drag-and-drop reorder.

Null disables reorder at zero cost. Non-null enables it, and the only required member is onReorder: the gesture, its affordance, the drag proxy, autoscroll and hover-to-expand all have working defaults.

The config's PRESENCE is fixed when the widget is created. Its CONTENTS are live on every rebuild. The drag tunings (autoExpandDelay, autoScrollEdgeZone, autoScrollMaxVelocity) are captured once per drag session at drag start, so a changed value applies from the next drag rather than retuning a live one.

To toggle reorder at runtime, keep the config and flip enabled, which disarms every handle rather than leaving grips that decline. canReorder remains the per-row policy.

Constructors

TreeReorderConfig({required void onReorder(TKey key, TKey? newParent, int index), bool enabled = true, bool canReorder(TKey key)?, bool canAcceptDrop({int? index, required TKey movingKey, TKey? newParent})?, ReorderSemanticsActionsBuilder<TKey>? semanticsActionsBuilder, bool buildDefaultDragHandles = true, double? indentWidth, bool showDragProxy = true, Widget dragProxyBuilder(BuildContext context, TKey key, Widget? rowChild)?, bool hapticsOnDrag = false, Duration? autoExpandDelay = const Duration(milliseconds: 700), double autoScrollEdgeZone = 48.0, double autoScrollMaxVelocity = 1200.0, void onControllerCreated(TreeReorderController<TKey> controller)?})
const

Properties

autoExpandDelay → Duration?
Hover-to-open delay for a collapsed drop target. Live on rebuild; captured once per drag session, so a change applies from the next drag.
final
autoScrollEdgeZone → double
Autoscroll edge band. Live on rebuild; captured per drag session.
final
autoScrollMaxVelocity → double
Peak autoscroll velocity. Live on rebuild; captured per drag session.
final
buildDefaultDragHandles → bool
Whether the package wraps each row in a TreeDelayedDragHandle, making the whole row draggable after a long press.
final
canAcceptDrop → bool Function({int? index, required TKey movingKey, TKey? newParent})?
Filters drop destinations. Also shapes the zones: a row that cannot take children collapses from a three-zone split to a two-zone one.
final
canReorder → bool Function(TKey key)?
Rows for which this returns false cannot be dragged.
final
dragProxyBuilder → Widget Function(BuildContext context, TKey key, Widget? rowChild)?
See SliverReorderableTree.dragProxyBuilder.
final
enabled → bool
Whether reordering is currently active. The runtime toggle.
final
hapticsOnDrag → bool
See SliverReorderableTree.hapticsOnDrag.
final
hashCode → int
The hash code for this object.
no setterinherited
indentWidth → double?
Pixels per depth level for mapping pointer x to a drop depth at subtree boundaries. Null (the default) uses the widget's own indentWidth, which is the indent it actually renders; these are the same constant read in opposite directions, and letting them drift keys depth selection to a column that appears nowhere on screen. Set it only when rows bake their own indent in itemBuilder (widget indentWidth 0).
final
onControllerCreated → void Function(TreeReorderController<TKey> controller)?
Hands back the internally owned reorder controller, right after it is created.
final
onReorder → void Function(TKey key, TKey? newParent, int index)
Reports a committed reorder. See TreeReorderController.onReorder for the index convention, which is live-space and names a position in the FINAL child list.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
semanticsActionsBuilder → ReorderSemanticsActionsBuilder<TKey>?
Transforms each row's assistive-technology reorder actions.
final
showDragProxy → bool
See SliverReorderableTree.showDragProxy.
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited