beginSlideBaseline method

void beginSlideBaseline({
  1. required Duration duration,
  2. required Curve curve,
})

Captures the current painted offsets so the next performLayout can install a FLIP slide from them to the post-mutation offsets.

Call this BEFORE invoking a structural mutation on the controller (reorderRoots, reorderChildren, moveNode). Calling it after the mutation would capture the already-new offsets and produce a zero-delta (no visible slide).

First-wins semantic: if a baseline is already pending this frame (from a prior call by any entry path — host fan-out OR a direct caller like the reorder controller), this call is a no-op. The first stage captured the truly-painted positions; subsequent stages would read already-mutated controller state and produce wrong deltas for rows touched by earlier same-frame calls.

Caller contract: every successful stage MUST be followed by a structural mutation that triggers a layout pass in the same frame (or via a microtask before the next frame). Otherwise the staged baseline stays pending and blocks all subsequent stages until some other layout-triggering mutation flushes it.

Internal contract — intended for the reorder controller and the controller's host fan-out. External callers should not invoke this directly.

Implementation

void beginSlideBaseline({required Duration duration, required Curve curve}) {
  // Not-laid-out guard: snapshotVisibleOffsets walks visible rows
  // accumulating extents from controller state. Before first layout,
  // those extents fall through to defaultExtent and the snapshot is
  // fictitious. Silently no-op rather than stage a garbage baseline.
  if (geometry == null) return;
  // First-wins.
  if (_pendingSlideBaseline != null) return;
  _pendingSlideBaseline = _SlideBaseline<TKey>(
    offsets: snapshotVisibleOffsets(),
    viewport: _currentViewportSnapshot(),
  );
  _pendingSlideDuration = duration;
  _pendingSlideCurve = curve;
}