hitTestLayoutChildren method

bool hitTestLayoutChildren(
  1. BoxHitTestResult result,
  2. RenderBox? child,
  3. Offset position
)

Implementation

bool hitTestLayoutChildren(
    BoxHitTestResult result, RenderBox? child, Offset position) {
  while (child != null) {
    final RenderLayoutParentData? childParentData =
        child.parentData as RenderLayoutParentData?;
    final bool isHit = result.addWithPaintTransform(
      transform: getEffectiveTransform(),
      position: position,
      hitTest: (BoxHitTestResult result, Offset position) {
        return result.addWithPaintOffset(
          offset: childParentData!.offset,
          position: position,
          hitTest: (BoxHitTestResult result, Offset transformed) {
            assert(transformed == position - childParentData.offset);
            return child!.hitTest(result, position: transformed);
          },
        );
      },
    );
    if (isHit) return true;
    child = childParentData!.previousSibling;
  }
  return false;
}