getPositionForOffset method

  1. @override
TextPosition getPositionForOffset(
  1. Offset offset
)
override

Returns the position within the text for the given pixel offset.

Valid only after layout.

Implementation

@override
TextPosition getPositionForOffset(Offset offset) {
  assert(!debugNeedsLayout);
  _layoutTextWithConstraints(constraints);
  return _textPainter.getPositionForOffset(offset);
}