hitTestChildren method

  1. @override
bool hitTestChildren(
  1. BoxHitTestResult result, {
  2. required Offset position,
})
override

Hits only a child whose band contains the position, so a widget scrolled under a pinned column cannot be pressed through it.

Implementation

@override
bool hitTestChildren(BoxHitTestResult result, {required Offset position}) {
  var child = lastChild;
  while (child != null) {
    final data = child.parentData! as FitGridCellParentData;
    final band = _bandOf(data.columnIndex);
    if (band != null && _bandLocalRect(band).contains(position)) {
      final box = child;
      final hit = result.addWithPaintOffset(
        offset: data.offset,
        position: position,
        hitTest: (result, transformed) =>
            box.hitTest(result, position: transformed),
      );
      if (hit) return true;
    }
    child = data.previousSibling;
  }
  return false;
}