Clean up the existing Navigator API. (#15718)
This is not a grand refactor yet, it's just cleaning up what we have already, so that people who keep using this API (e.g. dialogs) have something coherent to deal with. The major changes are that Navigator and NavigatorState have the same API now, that most of the examples use `<void>` instead of `<Null>`, that the navigator observer can see replaces, and that the `settings` is moved from ModalRoute to Route. I also cleaned up some of the API documentation.
This commit is contained in:
@@ -54,7 +54,7 @@ Widget buildFrame({
|
||||
localizationsDelegates: delegates,
|
||||
localeResolutionCallback: localeResolutionCallback,
|
||||
onGenerateRoute: (RouteSettings settings) {
|
||||
return new MaterialPageRoute<Null>(
|
||||
return new MaterialPageRoute<void>(
|
||||
builder: (BuildContext context) {
|
||||
return buildContent(context);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ void main() {
|
||||
textDirection: TextDirection.ltr,
|
||||
child: new Navigator(
|
||||
onGenerateRoute: (RouteSettings settings) {
|
||||
return new MaterialPageRoute<dynamic>(builder: (BuildContext context) {
|
||||
return new MaterialPageRoute<void>(builder: (BuildContext context) {
|
||||
return new FlatButton(
|
||||
onPressed: () {
|
||||
showTimePicker(context: context, initialTime: const TimeOfDay(hour: 7, minute: 0));
|
||||
|
||||
@@ -153,7 +153,7 @@ Widget buildFrame({
|
||||
localeResolutionCallback: localeResolutionCallback,
|
||||
supportedLocales: supportedLocales,
|
||||
onGenerateRoute: (RouteSettings settings) {
|
||||
return new PageRouteBuilder<Null>(
|
||||
return new PageRouteBuilder<void>(
|
||||
pageBuilder: (BuildContext context, Animation<double> _, Animation<double> __) {
|
||||
return buildContent(context);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user