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

Signature for the AnimatedCrossFade.layoutBuilder callback.

The topChild is the child fading in, which is normally drawn on top. The bottomChild is the child fading out, normally drawn on the bottom.

For good performance, the returned widget tree should contain both the topChild and the bottomChild; the depth of the tree, and the types of the widgets in the tree, from the returned widget to each of the children should be the same; and where there is a widget with multiple children, the top child and the bottom child should be keyed using the provided topChildKey and bottomChildKey keys respectively.

Sample code

Widget defaultLayoutBuilder(Widget topChild, Key topChildKey, Widget bottomChild, Key bottomChildKey) {
  return new Stack(
    fit: StackFit.loose,
    children: <Widget>[
      new Positioned(
        key: bottomChildKey,
        left: 0.0,
        top: 0.0,
        right: 0.0,
        child: bottomChild,
      ),
      new Positioned(
        key: topChildKey,
        child: topChild,
      )
    ],
  );
}