layoutBuilder property

A function that wraps all of the children that are transitioning out, and the child that's transitioning in, with a widget that lays all of them out. This is called every time this widget is built. The function must not return null.

The default PageTransitionSwitcherLayoutBuilder used is defaultLayoutBuilder.

The following example shows a layoutBuilder that places all entries in a Stack that sizes itself to match the largest of the active entries. All children are aligned on the top left corner of the Stack.

PageTransitionSwitcher(
  duration: const Duration(milliseconds: 100),
  child: Container(color: Colors.red),
  layoutBuilder: (
    List<Widget> entries,
  ) {
    return Stack(
      children: entries,
      alignment: Alignment.topLeft,
    );
  },
),

See PageTransitionSwitcherLayoutBuilder for more information about how a layout builder should function.

Implementation

final PageTransitionSwitcherLayoutBuilder layoutBuilder;