buildBodyWidget method Null safety

Widget buildBodyWidget(
  1. BuildContext context,
  2. Widget child
)

Builds body widget.

Implementation

Widget buildBodyWidget(BuildContext context, Widget child) {
  var children = child is Column ? child.children : [child];
  final renderMode = _widget?.renderMode ?? RenderMode.column;

  if (children.isNotEmpty && children.first is HeightPlaceholder) {
    children.removeAt(0);
  }
  if (children.isNotEmpty && children.last is HeightPlaceholder) {
    children.removeLast();
  }

  while (children.length == 1) {
    final child = children.first;
    if (child is Column) {
      children = child.children;
      continue;
    }

    if (renderMode != RenderMode.column && child is CssBlock) {
      final grandChild = child.child;
      if (grandChild is Column) {
        children = grandChild.children;
        continue;
      }
    }

    break;
  }

  return renderMode.buildBodyWidget(this, context, children);
}