menu static method

Widget menu({
  1. NavigatorStackControl? control,
  2. required Map<NavItem, WidgetBuilder> items,
  3. StackGroupBuilder? builder,
  4. bool overrideNavigation = true,
  5. RouteBuilderFactory? route,
})

Creates new Navigator and all underling Widgets will be pushed to this stack. With overrideNavigation Widget will create WillPopScope and handles back button.

NavigatorStack.group - Multiple NavigatorStacks in Stack. Only selected Controllers are visible - Offstage. Typically just one page is visible - usable with BottomNavigationBar to preserve navigation of separated pages. NavigatorStack.menu - Simplified version of NavigatorStack.group, can be used if access to NavigatorControls is not required.

NavigatorStackControl is used to navigate between multiple NavigatorStacks.

NavigatorStack

Implementation

static Widget menu({
  NavigatorStackControl? control,
  required Map<NavItem, WidgetBuilder> items,
  StackGroupBuilder? builder,
  bool overrideNavigation = true,
  RouteBuilderFactory? route,
}) {
  final stack = <NavigatorStack>[];

  items.forEach((key, value) => stack.add(NavigatorStack.single(
        control: NavigatorControl(key: key),
        builder: value,
        route: route,
      ) as NavigatorStack));

  return NavigatorStack.group(
    control: control,
    items: stack,
    builder: builder,
    overrideNavigation: overrideNavigation,
  );
}