childIsHit method

bool childIsHit(
  1. BoxHitTestResult result,
  2. RenderBox child, {
  3. required Offset position,
})

Implementation

bool childIsHit(BoxHitTestResult result, RenderBox child,
    {required Offset position}) {
  final ContainerParentDataMixin<RenderBox> childParentData =
      child.parentData as ContainerParentDataMixin<RenderBox>;
  final Offset offset = (childParentData as BoxParentData).offset;
  final bool isHit = result.addWithPaintOffset(
    offset: offset,
    position: position,
    hitTest: (BoxHitTestResult result, Offset transformed) {
      assert(transformed == position - offset);
      return child.hitTest(result, position: transformed);
    },
  );
  return isHit;
}