createRenderLayout method

RenderBoxModel createRenderLayout({
  1. bool isRepaintBoundary = false,
})

Implementation

RenderBoxModel createRenderLayout({bool isRepaintBoundary = false}) {
  CSSDisplay display = this.display;
  RenderBoxModel nextRenderLayoutBox;

  if (display == CSSDisplay.flex || display == CSSDisplay.inlineFlex) {
    if (isRepaintBoundary) {
      nextRenderLayoutBox = RenderRepaintBoundaryFlexLayout(
        renderStyle: this,
      );
    } else {
      nextRenderLayoutBox = RenderFlexLayout(
        renderStyle: this,
      );
    }
  } else if (display == CSSDisplay.grid || display == CSSDisplay.inlineGrid) {
    // Grid containers: create the grid render layout. For MVP, RenderGridLayout
    // inherits flow behavior and will be extended in subsequent steps.
    if (isRepaintBoundary) {
      nextRenderLayoutBox = RepaintBoundaryGridLayout(
        renderStyle: this
      );
    } else {
      nextRenderLayoutBox = RenderGridLayout(
        renderStyle: this,
      );
    }
  } else if (display == CSSDisplay.block ||
      display == CSSDisplay.none ||
      display == CSSDisplay.inline ||
      display == CSSDisplay.inlineBlock) {
    if (isRepaintBoundary) {
      nextRenderLayoutBox = RenderRepaintBoundaryFlowLayoutNext(
        renderStyle: this,
      );
    } else {
      nextRenderLayoutBox = RenderFlowLayout(
        renderStyle: this,
      );
    }
  } else {
    throw FlutterError('Not supported display type $display');
  }

  return nextRenderLayoutBox;
}