defaultLayoutBuilder method

Widget defaultLayoutBuilder (Widget currentChild, List<Widget> previousChildren)

The layout builder used as the default value of layoutBuilder.

The new child is placed in a Stack that sizes itself to match the largest of the child or a previous child. The children are centered on each other.

This is an AnimatedSwitcherLayoutBuilder function.

Implementation

static Widget defaultLayoutBuilder(Widget currentChild, List<Widget> previousChildren) {
  List<Widget> children = previousChildren;
  if (currentChild != null)
    children = children.toList()..add(currentChild);
  return Stack(
    children: children,
    alignment: Alignment.center,
  );
}