hitTest method

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

Hit-test this render object using position in local coordinates.

Implementation

@override
bool hitTest(HitTestResult result, Offset position) {
  if (position.dx < 0 ||
      position.dy < 0 ||
      position.dx >= width ||
      position.dy >= height) {
    return false;
  }

  final childHit = hitTestChildren(result, position);
  final selfHit = hitTestSelf(position);
  if (selfHit) {
    result.add(HitTestEntry(this as HitTestTarget, position));
  }
  return childHit || selfHit;
}