getBoxesForSelection method

List<TextBox> getBoxesForSelection(
  1. TextSelection selection

Returns a list of rects that bound the given selection, and the text direction. The text direction is used by the engine to calculate the closest position to a given point.

See TextPainter.getBoxesForSelection for more details.


List<TextBox> getBoxesForSelection(TextSelection selection) {
  return _textPainter.getBoxesForSelection(selection)
                     .map((TextBox textBox) => TextBox.fromLTRBD(
                        textBox.left + _paintOffset.dx,
               + _paintOffset.dy,
                        textBox.right + _paintOffset.dx,
                        textBox.bottom + _paintOffset.dy,