defaultLayoutBuilder method

Widget defaultLayoutBuilder (Widget topChild, Key topChildKey, Widget bottomChild, Key bottomChildKey)

The default layout algorithm used by AnimatedCrossFade.

The top child is placed in a stack that sizes itself to match the top child. The bottom child is positioned at the top of the same stack, sized to fit its width but without forcing the height. The stack is then clipped.

This is the default value for layoutBuilder. It implements AnimatedCrossFadeBuilder.

Implementation

static Widget defaultLayoutBuilder(Widget topChild, Key topChildKey, Widget bottomChild, Key bottomChildKey) {
  return Stack(
    overflow: Overflow.visible,
    children: <Widget>[
      Positioned(
        key: bottomChildKey,
        left: 0.0,
        top: 0.0,
        right: 0.0,
        child: bottomChild,
      ),
      Positioned(
        key: topChildKey,
        child: topChild,
      )
    ],
  );
}