of static method

The NavigationThemeData for context.

Returns Material defaults when no NavigationTheme is present in the tree above context, so navigation pages always render with valid colors even in an unconfigured app.

Implementation

static NavigationThemeData of(BuildContext context) {
  final inherited = context
      .dependOnInheritedWidgetOfExactType<NavigationTheme>();
  return inherited?.data ?? const NavigationThemeData();
}