getLocalRectForCaret method

  1. @override
Rect getLocalRectForCaret(
  1. TextPosition position
)
override

Returns the Rect in local coordinates for the caret at the given text position.

Implementation

@override
Rect getLocalRectForCaret(TextPosition position) {
  final child = childAtPosition(position);
  final localPosition = TextPosition(
    offset: position.offset - child.container.offset,
    affinity: position.affinity,
  );
  final parentData = child.parentData as BoxParentData;
  return child.getLocalRectForCaret(localPosition).shift(parentData.offset);
}