addToContainingBlock method

void addToContainingBlock()

Implementation

void addToContainingBlock() {
  RenderBoxModel _renderBoxModel = renderBoxModel!;
  // Find the renderBox of its containing block.
  RenderBox? containingBlockRenderBox = getContainingBlockRenderBox();
  // Find the previous siblings to insert before renderBoxModel is detached.
  RenderBox? previousSibling = _renderBoxModel.getPreviousSibling();
  // Detach renderBoxModel from its original parent.
  _renderBoxModel.detachFromContainingBlock();
  // Original parent renderBox.
  RenderBox parentRenderBox = parentNode!.renderer!;
  // Attach renderBoxModel of to its containing block.
  _renderBoxModel.attachToContainingBlock(containingBlockRenderBox, parent: parentRenderBox, after: previousSibling);
}