addChildRenderObject method

void addChildRenderObject(
  1. Element child, {
  2. RenderBox? after,
})
inherited

Implementation

void addChildRenderObject(Element child, {RenderBox? after}) {
  CSSPositionType positionType = child.renderBoxModel!.renderStyle.position;
  RenderLayoutBox? _scrollingContentLayoutBox = scrollingContentLayoutBox;
  switch (positionType) {
    case CSSPositionType.absolute:
    case CSSPositionType.fixed:
      _addPositionedChild(child, positionType);
      break;
    case CSSPositionType.sticky:
    case CSSPositionType.relative:
    case CSSPositionType.static:
      RenderLayoutBox? parentRenderLayoutBox = _scrollingContentLayoutBox ?? _renderLayoutBox;

      if (parentRenderLayoutBox != null) {
        parentRenderLayoutBox.insert(child.renderBoxModel!, after: after);

        if (positionType == CSSPositionType.sticky) {
          _addPositionHolder(parentRenderLayoutBox, child, positionType);
        }
      }
      break;
  }
}