hitTestChildren method

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

Override this to test whether your children hit at the given position.

Implementation

@override
bool hitTestChildren(
  HitTestResult result, {
  required Offset position,
}) {
  for (final child in children.reversed) {
    final childParentData = child.parentData as FlexParentData;

    final childPosition = position - childParentData.offset;

    if (child.hitTest(result, position: childPosition)) {
      return true;
    }
  }

  return false;
}