getBoxesForSelection method

  1. @override
List<TextBox> getBoxesForSelection(
  1. TextSelection selection, {
  2. BoxHeightStyle boxHeightStyle = ui.BoxHeightStyle.tight,
  3. BoxWidthStyle boxWidthStyle = ui.BoxWidthStyle.tight,
})
override

Returns a list of rects that bound the given selection.

A given selection might have more than one rect if this text painter contains bidirectional text because logically contiguous text might not be visually contiguous.

Valid only after layout.

Implementation

@override
List<ui.TextBox> getBoxesForSelection(
  TextSelection selection, {
  ui.BoxHeightStyle boxHeightStyle = ui.BoxHeightStyle.tight,
  ui.BoxWidthStyle boxWidthStyle = ui.BoxWidthStyle.tight,
}) {
  assert(!debugNeedsLayout);
  _layoutTextWithConstraints(constraints);
  return _textPainter.getBoxesForSelection(
    selection,
    boxHeightStyle: boxHeightStyle,
    boxWidthStyle: boxWidthStyle,
  );
}