hitTestChild static method
bool
hitTestChild(
- BoxHitTestResult result,
- RenderBox child,
- Offset effectiveOffset, {
- required Offset position,
Implementation
static bool hitTestChild(
BoxHitTestResult result,
RenderBox child,
Offset effectiveOffset, {
required Offset position,
}) {
final TextParentData textParentData = child.parentData as TextParentData;
final Offset? offset = textParentData.offset;
if (offset == null) {
return false;
}
final Matrix4 transform = Matrix4.translationValues(
offset.dx + effectiveOffset.dx, offset.dy + effectiveOffset.dy, 0.0);
final bool isHit = result.addWithPaintTransform(
transform: transform,
position: position,
hitTest: (BoxHitTestResult result, Offset transformed) {
assert(() {
final Offset manualPosition = position - offset - effectiveOffset;
return (transformed.dx - manualPosition.dx).abs() <
precisionErrorTolerance &&
(transformed.dy - manualPosition.dy).abs() <
precisionErrorTolerance;
}());
return child.hitTest(result, position: transformed);
},
);
return isHit;
}