DashboardNestedCoordinator class

Coordinates every dashboard living under a DashboardNestedScope:

  • pointer claiming, so a drag started in a nested grid is not also handled by its ancestors;
  • the cross-grid drag session — temporary removal from the source grid, live placeholder in the hovered grid, floating proxy, and the final drop or cancel;
  • the parent/child links used for tree export/import and for the subGridDynamic hover detection.

The coordinator performs no layout math itself: geometry stays in the overlays (view layer) and layout mutations stay in the controllers.

Constructors

DashboardNestedCoordinator({DashboardItemMovedToGridCallback? onItemMovedToGrid, DashboardNestedGridRequestCallback? onNestedGridRequested, DashboardNestedGridAbandonedCallback? onNestedGridRequestAbandoned, DashboardItemDroppedOnHostCallback? onItemDroppedOnHost, DashboardCloneRequestCallback? onCloneRequested, bool subGridDynamic = false, bool subGridDynamicSameGrid = false, Duration nestHoverDelay = const Duration(milliseconds: 600), CrossGridProbe probe = CrossGridProbe.pointer, int? maxNestingDepth, DimensionProjectionPolicy projectionPolicy = DimensionProjectionPolicy.preserveLogicalSize, DimensionProjectionCallback? customProjectionCallback, double hoverJitterTolerance = 4.0, DashboardCanAcceptItemCallback? canAcceptItem})
Creates a coordinator. Usually done by DashboardNestedScope.

Properties

canAcceptItem ↔ DashboardCanAcceptItemCallback?
Business filter deciding which items each grid of the tree accepts.
getter/setter pair
customProjectionCallback ↔ DimensionProjectionCallback?
A custom callback to project item dimensions when projectionPolicy is set to DimensionProjectionPolicy.custom.
getter/setter pair
hashCode → int
The hash code for this object.
no setterinherited
hoverJitterTolerance ↔ double
Low-pass jitter filter for nest-hover host switching, in logical pixels.
getter/setter pair
maxNestingDepth ↔ int?
Maximum number of nesting levels allowed, or null (default) for no limit.
getter/setter pair
nestHoverDelay ↔ Duration
How long the user must hover a plain item before onNestedGridRequested fires.
getter/setter pair
onCloneRequested ↔ DashboardCloneRequestCallback?
Scope-wide default for Alt+drag tile duplication: produces the duplicate of a tile whose drag started with the clone modifier held (Alt / Option by default, see DashboardShortcuts.cloneKeys).
getter/setter pair
onItemDroppedOnHost ↔ DashboardItemDroppedOnHostCallback?
Fired when dragged items are released over a DROP TARGET tile: a host whose hasNestedGrid is set but whose child grid is not mounted (a "closed folder"), or any item flagged LayoutItem.isDropTarget.
getter/setter pair
onItemMovedToGrid ↔ DashboardItemMovedToGridCallback?
Fired after a successful cross-grid move (drag & drop or programmatic).
getter/setter pair
onNestedGridRequestAbandoned ↔ DashboardNestedGridAbandonedCallback?
Contract note: host is the item snapshot taken WHEN THE REQUEST ARMED — original id, original geometry, before any conversion or sizeToContent growth. Reverting a speculative conversion should restore from this snapshot (id and w/h), not from the item's current state on the grid.
getter/setter pair
onNestedGridRequested ↔ DashboardNestedGridRequestCallback?
Fired when a dragged item is held over a plain item long enough to request a dynamic nested grid (see subGridDynamic).
getter/setter pair
probe ↔ CrossGridProbe
Which point decides the grid under a cross-grid drag (see CrossGridProbe).
getter/setter pair
projectionPolicy ↔ DimensionProjectionPolicy
The active dimension projection policy when dragging across asymmetrical grids.
getter/setter pair
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
sessionActive → bool
Whether a cross-grid drag session is in progress.
no setter
sessionGrabFraction → Offset?
The grab point of the active cross-grid session, expressed as a FRACTION of the dragged tile's own pixel size — (0,0) grabbed by its top-left, (0.5,0.5) grabbed at its centre.
no setter
subGridDynamic ↔ bool
Enables the subGridDynamic hover detection.
getter/setter pair
subGridDynamicSameGrid ↔ bool
Extends subGridDynamic to drags that never leave their own grid.
getter/setter pair

Methods

beginSession({required CrossGridDragTarget source, required LayoutItem item, required Offset globalPosition, required Offset grabOffset, required Size itemPixelSize, required BuildContext overlayContext, required Widget proxyChild, double proxyOpacity = 0.85}) → void
Starts a cross-grid session: silently removes the dragged item from the source grid (temporary removal) and spawns the floating proxy that visually carries the item between grids.
cancelSession() → void
Cancels an active session (Escape, pointer cancel, disposal) and restores the source grid to its pre-drag layout.
canHostAtDepth(int depth) → bool
Whether a grid at depth (root = 0) may host a nested grid one level deeper, given maxNestingDepth. Always true when no limit is set.
childGridsOf(DashboardController parent) → Map<String, DashboardController>
The child grid controllers of parent, keyed by host item id — whether or not their NestedDashboard is currently mounted. Links survive virtualization unmounts; they are removed only by unlinkChildGrid (or overwritten by a new linkChildGrid).
childrenOf(DashboardController parent) → List<NestedGridRegistration>
All registered direct children of parent (mounted nested grids).
claimPointer(CrossGridDragTarget owner) → void
Claims the active pointer for owner. Called by an overlay when it actually starts an interaction, before its ancestors receive the same pointer-down (hit-test dispatch is deepest-first).
deliverChildGrid(String parentItemId, NestedGridData data) → void
Delivers grid data to the nested grid hosted by parentItemId: applies it immediately when that grid is already mounted, otherwise stashes it for consumption on mount. Used by loadNestedTree so that re-loading a tree over live grids works without a remount.
dispose() → void
Releases coordinator resources. Called by the scope on dispose.
dropSession(Offset globalPosition) → LayoutItem?
Finalizes an active session on pointer-up.
hasAnyTargetBesides(CrossGridDragTarget self, {LayoutItem? draggedItem}) → bool
Whether at least one registered grid other than self currently accepts cross-grid items. Used by source overlays to avoid starting a pointless exit session (proxy pop-out, silent removal) when there is nowhere else the item could possibly land — e.g. a single-grid scope opened only for subGridDynamicSameGrid.
hasChildGrid(DashboardController host, String itemId) → bool
Whether the item itemId of host hosts a nested grid.
isDescendantOf(NestedGridRegistration reg, DashboardController parentController, String parentItemId) → bool
Returns true if the grid of reg lives inside parentItemId of parentController, either directly or nested deeply within its descendant subtree.
isPointerClaimedByOther(CrossGridDragTarget me) → bool
Whether a grid other than me already handles the active pointer.
isSessionOwner(CrossGridDragTarget source) → bool
Whether the active session (if any) is owned by source.
linkChildGrid({required DashboardController parent, required String parentItemId, required DashboardController child}) → void
Declares that the grid driven by child lives inside the item parentItemId of parent. Called by NestedDashboard.
moveItemToGrid({required DashboardController from, required DashboardController to, required String itemId, int? x, int? y}) → LayoutItem?
Moves itemId from from to to, preserving its size and constraints.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyNestRequestFired(LayoutItem host, DashboardController hostGrid) → void
Records that onNestedGridRequested has fired for host in hostGrid. Called by both arming paths right before the callback.
probePointFor(Offset globalPosition, {required Offset grabOffset, required Size itemPixelSize}) → Offset
The probe point for the active session at pointer globalPosition: the pointer itself, or the dragged tile's visual center.
projectItem(LayoutItem item, {required int sourceSlotCount, required int targetSlotCount, SlotMetrics? sourceMetrics, SlotMetrics? targetMetrics}) → LayoutItem
Projects an item's width and height based on the active projectionPolicy and the geometry of the source and target grids.
projectItemBetween({required DashboardController from, required DashboardController to, required LayoutItem item}) → LayoutItem
Projects item between two LIVE grids exactly as a cross-grid drag would, honouring the active projectionPolicy.
register(CrossGridDragTarget target, {required int depth}) → NestedGridRegistration
Registers a grid. Called by the overlay on mount.
registrationOf(DashboardController controller) → NestedGridRegistration?
The registration for controller, or null.
releasePointer(CrossGridDragTarget owner) → void
Releases the pointer claim if held by owner.
resolveNestRequest(DashboardController? droppedInto) → void
Resolves the pending nested-grid request, if any. droppedInto is the grid that received the item, or null when the drag ended without a cross-grid drop. Fires onNestedGridRequestAbandoned unless the item landed in the child grid of the requested host. Idempotent.
stashChildGrid(String parentItemId, NestedGridData data) → void
Stashes grid data for a nested grid that has not mounted yet.
takeStashedChildGrid(String parentItemId) → NestedGridData?
Takes (and removes) stashed grid data for parentItemId, if any.
targetAt(Offset globalPosition, {bool acceptingOnly = true, DashboardController? excludeSourceController, String? excludeItemId, LayoutItem? draggedItem, DashboardController? sourceController}) → NestedGridRegistration?
Resolves the deepest registered grid whose interactive area contains globalPosition. Grids that do not CrossGridDragTarget.canAcceptCrossGridItems are skipped when acceptingOnly is true.
toString() → String
A string representation of this object.
inherited
unlinkChildGrid(DashboardController child) → void
Removes the parent link of child (called by NestedDashboard on dispose or when its controller changes).
unregister(CrossGridDragTarget target) → void
Unregisters a grid. Called by the overlay on dispose.
updateSession(Offset globalPosition) → void
Routes a pointer move of an active session: updates the proxy, fires leave/enter between hovered grids, drives the hovered grid's placeholder and, when subGridDynamic is on, the nest-hover arming.

Operators

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