Unverified Commit f0620f47 authored by Dan Field's avatar Dan Field Committed by GitHub

add type parameter back to PageRouteFactory (#26559)

parent 774e8c18
...@@ -274,10 +274,8 @@ class _CupertinoAppState extends State<CupertinoApp> { ...@@ -274,10 +274,8 @@ class _CupertinoAppState extends State<CupertinoApp> {
key: GlobalObjectKey(this), key: GlobalObjectKey(this),
navigatorKey: widget.navigatorKey, navigatorKey: widget.navigatorKey,
navigatorObservers: _navigatorObservers, navigatorObservers: _navigatorObservers,
// TODO(dnfield): when https://github.com/dart-lang/sdk/issues/34572 is resolved pageRouteBuilder: <T>(RouteSettings settings, WidgetBuilder builder) =>
// this can use type arguments again CupertinoPageRoute<T>(settings: settings, builder: builder),
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
CupertinoPageRoute<dynamic>(settings: settings, builder: builder),
home: widget.home, home: widget.home,
routes: widget.routes, routes: widget.routes,
initialRoute: widget.initialRoute, initialRoute: widget.initialRoute,
......
...@@ -411,10 +411,8 @@ class _MaterialAppState extends State<MaterialApp> { ...@@ -411,10 +411,8 @@ class _MaterialAppState extends State<MaterialApp> {
key: GlobalObjectKey(this), key: GlobalObjectKey(this),
navigatorKey: widget.navigatorKey, navigatorKey: widget.navigatorKey,
navigatorObservers: _navigatorObservers, navigatorObservers: _navigatorObservers,
// TODO(dnfield): when https://github.com/dart-lang/sdk/issues/34572 is resolved pageRouteBuilder: <T>(RouteSettings settings, WidgetBuilder builder) =>
// this can use type arguments again MaterialPageRoute<T>(settings: settings, builder: builder),
pageRouteBuilder: (RouteSettings settings, WidgetBuilder builder) =>
MaterialPageRoute<dynamic>(settings: settings, builder: builder),
home: widget.home, home: widget.home,
routes: widget.routes, routes: widget.routes,
initialRoute: widget.initialRoute, initialRoute: widget.initialRoute,
......
...@@ -83,9 +83,7 @@ typedef GenerateAppTitle = String Function(BuildContext context); ...@@ -83,9 +83,7 @@ typedef GenerateAppTitle = String Function(BuildContext context);
/// The signature of [WidgetsApp.pageRouteBuilder]. /// The signature of [WidgetsApp.pageRouteBuilder].
/// ///
/// Creates a [PageRoute] using the given [RouteSettings] and [WidgetBuilder]. /// Creates a [PageRoute] using the given [RouteSettings] and [WidgetBuilder].
// TODO(dnfield): when https://github.com/dart-lang/sdk/issues/34572 is resolved typedef PageRouteFactory = PageRoute<T> Function<T>(RouteSettings settings, WidgetBuilder builder);
// this can use type arguments again
typedef PageRouteFactory = PageRoute<dynamic> Function(RouteSettings settings, WidgetBuilder builder);
/// A convenience class that wraps a number of widgets that are commonly /// A convenience class that wraps a number of widgets that are commonly
/// required for an application. /// required for an application.
...@@ -754,7 +752,7 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv ...@@ -754,7 +752,7 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
assert(widget.pageRouteBuilder != null, assert(widget.pageRouteBuilder != null,
'The default onGenerateRoute handler for WidgetsApp must have a ' 'The default onGenerateRoute handler for WidgetsApp must have a '
'pageRouteBuilder set if the home or routes properties are set.'); 'pageRouteBuilder set if the home or routes properties are set.');
final Route<dynamic> route = widget.pageRouteBuilder( final Route<dynamic> route = widget.pageRouteBuilder<dynamic>(
settings, settings,
pageContentBuilder, pageContentBuilder,
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment