menu static method
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.
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,
);
}