attachTo method

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

Attach a renderObject to parent.

Implementation

@override
void attachTo(Element parent, { RenderBox? after }) {
  // Empty string of TextNode should not attach to render tree.
  if (_data.isEmpty) return;

  createRenderer();

  if (parent.renderBoxModel is RenderLayoutBox) {
    RenderLayoutBox parentRenderLayoutBox = parent.renderBoxModel as RenderLayoutBox;
    parentRenderLayoutBox = parentRenderLayoutBox.renderScrollingContent ?? parentRenderLayoutBox;
    parentRenderLayoutBox.insert(_renderTextBox!, after: after);
    _applyTextStyle();
  }
}