getBoxesForSelectionRects method

List<Rect> getBoxesForSelectionRects(
  1. TextSelection selection
)

Returns a list of rects that bound the given selection.

See TextPainter.getBoxesForSelection for more details.

Implementation

List<Rect> getBoxesForSelectionRects(TextSelection selection) {
  _computeTextMetricsIfNeeded();
  return textPainter
      .getBoxesForSelection(selection)
      .map((TextBox textBox) => textBox.toRect().shift(paintOffset))
      .toList();
}