hitTestChildren method

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

HIT TEST

Implementation

@override
bool hitTestChildren(BoxHitTestResult result, {required Offset position}) {
  for (final child in children) {
    final parentData = child.parentData! as BoxParentData;
    final isHit = result.addWithPaintOffset(
      offset: parentData.offset,
      position: position,
      hitTest: (BoxHitTestResult result, Offset transformed) {
        assert(transformed == position - parentData.offset);
        return child.hitTest(result, position: transformed);
      },
    );
    if (isHit) {
      return true;
    }
  }
  return false;
}