getBoxesForSelection method Null safety
- TextSelection selection,
- {BoxHeightStyle boxHeightStyle = ui.BoxHeightStyle.tight,
- BoxWidthStyle boxWidthStyle = ui.BoxWidthStyle.tight}
Returns a list of rects that bound the given selection.
The boxHeightStyle
and boxWidthStyle
arguments may be used to select
the shape of the TextBox
s. These properties default to
ui.BoxHeightStyle.tight and ui.BoxWidthStyle.tight respectively and
must not be null.
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.
Leading or trailing newline characters will be represented by zero-width
Textbox
es.
The method only returns TextBox
es of glyphs that are entirely enclosed by
the given selection
: a multi-code-unit glyph will be excluded if only
part of its code units are in selection
.
Implementation
List<TextBox> getBoxesForSelection(
TextSelection selection, {
ui.BoxHeightStyle boxHeightStyle = ui.BoxHeightStyle.tight,
ui.BoxWidthStyle boxWidthStyle = ui.BoxWidthStyle.tight,
}) {
assert(_debugAssertTextLayoutIsValid);
assert(boxHeightStyle != null);
assert(boxWidthStyle != null);
return _paragraph!.getBoxesForRange(
selection.start,
selection.end,
boxHeightStyle: boxHeightStyle,
boxWidthStyle: boxWidthStyle,
);
}