hitTestInlineChildren method

  1. @protected
bool hitTestInlineChildren(
  1. BoxHitTestResult result,
  2. Offset position
)

Performs a hit test on each inline child.

Render children whose TextParentData.offset is null will be skipped by this method.

Implementation

@protected
bool hitTestInlineChildren(BoxHitTestResult result, Offset position) {
  RenderBox? child = firstChild;
  while (child != null) {
    final TextParentData childParentData = child.parentData! as TextParentData;
    final Offset? childOffset = childParentData.offset;
    if (childOffset == null) {
      return false;
    }
    final bool isHit = result.addWithPaintOffset(
      offset: childOffset,
      position: position,
      hitTest: (BoxHitTestResult result, Offset transformed) => child!.hitTest(result, position: transformed),
    );
    if (isHit) {
      return true;
    }
    child = childAfter(child);
  }
  return false;
}