childNavigator property
Navigator?
get
childNavigator
When StandardPageWithResultFactory.parentPageType is set, it retrieves the child Navigator widget. This is used when creating applications with features like footer tabs.
For example, let's say there's a page called PageA, which is a tab, and it is set as the parentPageType for PageB.
StandardMaterialApp(
onGenerateTitle: (context) => l(context, 'tab page'),
pages: [
StandardPageFactory<PageA, void>(
create: (data) => PageA(),
),
StandardPageFactory<PageB, void>(
create: (data) => PageB,
parentPageType: PageA,
),
],
);
In this case, PageA displays the widget that shows the tab in the footer, but there is no widget to display within it. Therefore, you can use childNavigator to retrieve and display the content of PageB
class PageA extends StandardPage<void> {
@override
Widget buildPage(BuildContext context) {
return childNavigator!; // Display the content of PageB
}
}
Implementation
Navigator? get childNavigator => _navigator;