sliver_tree/tree_reorder_controller library
Orchestrates drag-and-drop reorder over a TreeController-backed SliverTree: gesture lifecycle, drop-target resolution, autoscroll near viewport edges, and FLIP slide animation on commit.
The controller holds no PER-FRAME state outside an active drag (the
monotonic TreeReorderController.dragGeneration survives idleness by
design). A drag session begins with startDrag, receives
pointer updates via updateDrag, and ends with endDrag (commit) or
cancelDrag (no-op). Only one session can be active at a time.
This file owns the PUBLIC API, policy (canReorder/canAcceptDrop,
autoscroll/dwell tuning), the notification channels, and the
COMMIT SCRIPT. Animation timing is NOT owned here: the drag
animations read the tree controller's animationStyle
(reorderSlide for the commit FLIP, effectiveMakeRoom for the
gap, effectiveDropSettle for the proxy glides), resolved once per
session at startDrag. Everything else is delegated to the session
architecture:
DragSession(_drag_session.dart): per-drag state; the singleresolve()choreography site and the singledetachAll(SessionExit)teardown site.PointerSpace: the ONLY component touching the scrollable; every read is nullable (null = defunct scrollable) and every pointer event costs exactly one viewport lookup.DragProbe: grab geometry + the touch-first probe shift + the resolution core over DropZoneResolver (_drop_zone_resolver.dart).- Behavior collaborators (
_drag_session_behaviors.dart):AutoScroller(per-session ticker),DwellExpander,MakeRoomDriver,DropSettler.
Render-layer access goes exclusively through ReorderRenderPort: this package never lets reorder code touch the concrete render object. Coordinate space is exclusively sliver-local scroll-space (distance from the start of the sliver's scroll extent, matching SliverTreeParentData.layoutOffset).
Classes
-
TreeDropTarget<
TKey> - Resolved semantic drop target for the current pointer position during a drag.
-
TreeReorderController<
TKey> - Controls a drag-and-drop reorder over a TreeController.
Enums
- TreeDropZone
- Where the pointer lies relative to a candidate drop-target row.