getTextPositionAbove method
- TextPosition position
override
Returns the TextPosition above the given offset into the text.
If the offset is already on the first line, the given offset will be returned.
Implementation
@override
TextPosition getTextPositionAbove(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 = -0.5 * preferredLineHeight;
return _getTextPositionVertical(position, verticalOffset);
}