hitTestChildren method

  1. @override
bool hitTestChildren(
  1. HitTestResult result,
  2. Offset position
)
override

Hit-test children in reverse paint order.

Implementation

@override
bool hitTestChildren(HitTestResult result, Offset position) {
  final c = child;
  if (c == null) {
    return false;
  }
  if (position.dx < 0 ||
      position.dy < 0 ||
      position.dx >= _viewportWidth ||
      position.dy >= _viewportHeight) {
    return false;
  }

  final scrollX = _scrollDirection == Axis.horizontal
      ? _controller.offset.round()
      : 0;
  final scrollY = _scrollDirection == Axis.vertical
      ? _controller.offset.round()
      : 0;
  final childPosition =
      position - Offset(c.x, c.y) + Offset(scrollX, scrollY);
  return c.hitTest(result, childPosition);
}