getBoxesForSelection method

List<Rect> getBoxesForSelection(
  1. TextSelection selection
)

Returns a list of rects that bound the given selection.

See MongolTextPainter.getBoxesForSelection for more details.

Implementation

List<Rect> getBoxesForSelection(TextSelection selection) {
  _computeTextMetricsIfNeeded();
  return _textPainter
      .getBoxesForSelection(selection)
      .map((rect) => rect.shift(_paintOffset))
      .toList();
}