captureGrab method

void captureGrab({
  1. required PointerSample start,
  2. required bool midpointProbe,
})

Captures grab geometry once at session start against the start sample.

Asks the render port where the DRAGGED KEY is painted rather than what row sits under the pointer. The two differ at a sticky header: a pinned header paints in its pinned band while its structural offset has scrolled away above, so ReorderRenderPort.findRowAtPaintedY would answer with whatever content is scrolled UNDERNEATH the pinned strip, and the capture would take that foreign row's offset and extent.

Addressing the key directly leaves no "wrong row" case, so a located row is always trustworthy geometry and midpointProbe applies whenever it is requested. The one failure left is an unlocatable (unmounted) row, which zeroes the record: there is no trustworthy extent to report either, and a zero extent is already the drag proxy's "size to your content" signal.

Implementation

void captureGrab({
  required PointerSample start,
  required bool midpointProbe,
}) {
  final bounds = _renderPort.paintedRowBounds(_draggedKey);
  if (bounds == null) {
    _grabDy = 0.0;
    _grabRowExtent = 0.0;
    return;
  }
  _grabDy = (start.sliverY - bounds.paintedOffset).clamp(0.0, bounds.extent);
  _grabRowExtent = bounds.extent;
  if (midpointProbe) {
    _probeDy = bounds.extent / 2 - _grabDy;
  }
}