getTextPositionBelow method Null safety

  1. @override
TextPosition getTextPositionBelow(
  1. TextPosition position
)
override

Returns the TextPosition below the given offset into the text.

If the offset is already on the last line, the given offset will be returned.

Implementation

@override
TextPosition getTextPositionBelow(TextPosition position) {
  // The caret offset gives a location in the upper left hand corner of
  // the caret so the middle of the line above is a half line above that
  // point and the line below is 1.5 lines below that point.
  final double preferredLineHeight = _textPainter.preferredLineHeight;
  final double verticalOffset = 1.5 * preferredLineHeight;
  return _getTextPositionVertical(position, verticalOffset);
}