willAttachRenderer method

  1. @override
void willAttachRenderer()

The renderObject will be / has been insert into parent. You can apply properties to renderObject.

This method should not do anything to update the children of the render object.

Implementation

@override
void willAttachRenderer() {
  super.willAttachRenderer();
  double viewportWidth = elementManager.viewportWidth;
  double viewportHeight = elementManager.viewportHeight;
  Size viewportSize = Size(viewportWidth, viewportHeight);

  sizedBox = RenderConstrainedBox(
    additionalConstraints: BoxConstraints.loose(Size(
      CSSLength.toDisplayPortValue(ELEMENT_DEFAULT_WIDTH, viewportSize)!,
      CSSLength.toDisplayPortValue(ELEMENT_DEFAULT_HEIGHT, viewportSize)!,
    )),
  );

  addChild(sizedBox);
  style.addStyleChangeListener(_propertyChangedListener);
}