ensureChildAttached method

  1. @override
void ensureChildAttached()
override

Ensure child and child's child render object is attached.

Implementation

@override
void ensureChildAttached() {
  if (isRendererAttachedToSegmentTree) {
    final box = renderBoxModel;
    if (box == null) return;
    for (Node child in childNodes) {
      RenderBox? after;
      if (box is RenderLayoutBox) {
        RenderLayoutBox? scrollingContentBox = box.renderScrollingContent;
        if (scrollingContentBox != null) {
          after = scrollingContentBox.lastChild;
        } else {
          after = box.lastChild;
        }
      } else if (box is RenderSVGContainer) {
        after = box.lastChild;
      }
      if (!child.isRendererAttachedToSegmentTree) {
        child.attachTo(this, after: after);
        child.ensureChildAttached();
      }
    }
  }
}