positionInlineChildren method

  1. @override
void positionInlineChildren(
  1. List<TextBox> boxes
)
override

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:

Implementation

@override
void positionInlineChildren(List<ui.TextBox> boxes) {
  final inverse = _inverse;
  if (inverse == null || boxes.length != inverse.length) {
    // Not reordering, or the engine dropped placeholders (ellipsis). Either
    // way, hand the boxes over untouched.
    super.positionInlineChildren(boxes);
    return;
  }
  // `super` walks the children in order and gives child `i` the box at index
  // `i`, so hand it a list already arranged that way.
  super.positionInlineChildren(<ui.TextBox>[
    for (var child = 0; child < boxes.length; child++) boxes[inverse[child]],
  ]);
}