build method
Returns a Navigator with a single page. Wraps the page in a PathStackPathProvider so the top-most PathStack can grab the current route path. Calls NavigatorState.widget.stackBuilder to build the page contents.
Implementation
@override
Widget build(BuildContext _) {
_recordHistoryEntry(controller.path);
return Material(
child: Navigator(
key: navigatorKey,
transitionDelegate: NoAnimationTransitionDelegate(),
pages: [
MaterialPage(
// Create a context that can access the Navigator above, so the stackBuilder() delegate can show dialogs, overlays etc
child: Builder(builder: (context) {
// Allow StackController to be inherited
return InheritedNavStackController(
controller: controller,
// Provide the path to all child PathStack widgets,
// this saves us the boilerplate of setting .path manually on each instance.
child: PathStackPathProvider(
path: controller.path,
// Build the actual stack
child: controller.stackBuilder(context, controller),
),
);
}),
),
],
onPopPage: (_, __) => false,
),
);
}