defaultLayoutBuilder static method

Widget defaultLayoutBuilder(
  1. Widget topChild,
  2. Key topChildKey,
  3. Widget bottomChild,
  4. 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.


static Widget defaultLayoutBuilder(Widget topChild, Key topChildKey, Widget bottomChild, Key bottomChildKey) {
  return Stack(
    clipBehavior: Clip.none,
    children: <Widget>[
        key: bottomChildKey,
        left: 0.0,
        top: 0.0,
        right: 0.0,
        child: bottomChild,
        key: topChildKey,
        child: topChild,