attachTo method

  1. @override
void attachTo(
  1. Element parent, {
  2. RenderBox? after,
})
inherited

Attach a renderObject to parent.

Implementation

@override
void attachTo(Element parent, {RenderBox? after}) {
  CSSDisplay display = CSSDisplayMixin.getDisplay(style[DISPLAY] ?? defaultDisplay);

  if (display == CSSDisplay.sliver) {
    _sliverBoxChildManager = ElementSliverBoxChildManager(this);
  } else {
    _sliverBoxChildManager = null;
  }

  if (display != CSSDisplay.none) {
    _beforeRendererAttach();
    parent.addChildRenderObject(this, after: after);
    _afterRendererAttach();
  }

  // CSS Transition works after dom has layouted, so it needs to mark
  // the renderBoxModel as layouted on the next frame.
  SchedulerBinding.instance!.addPostFrameCallback((timestamp) {
    renderBoxModel?.firstLayouted = true;
  });
}