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 caretOffset = getOffsetForCaret(position);
  var rect = Rect.fromLTWH(0, 0, cursorWidth, cursorHeight).shift(caretOffset);
  final cursorOffset = cursorCont.style.offset;
  // Add additional cursor offset (generally only if on iOS).
  if (cursorOffset != null) rect = rect.shift(cursorOffset);
  return rect;
}