positionInlineChildren method
Positions each inline child according to the coordinates provided in the
boxes
list.
The boxes
list must be in logical order, which is the order each child
is encountered when the user reads the text. Usually the length of the
list equals childCount, but it can be less than that, when some children
are omitted due to ellipsing. It never exceeds childCount.
See also:
- TextPainter.inlinePlaceholderBoxes, the method that can be used to
get the input
boxes
.
Implementation
@protected
void positionInlineChildren(List<ui.TextBox> boxes) {
RenderBox? child = firstChild;
for (final ui.TextBox box in boxes) {
if (child == null) {
assert(false, 'The length of boxes (${boxes.length}) should be greater than childCount ($childCount)');
return;
}
final TextParentData textParentData = child.parentData! as TextParentData;
textParentData._offset = Offset(box.left, box.top);
child = childAfter(child);
}
while (child != null) {
final TextParentData textParentData = child.parentData! as TextParentData;
textParentData._offset = null;
child = childAfter(child);
}
}