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:
Ian Hickson
2018-03-22 13:21:07 -07:00
committed by GitHub
parent 3a2e0d9375
commit aba0379dcc
63 changed files with 1614 additions and 789 deletions

View File

@@ -47,37 +47,37 @@ class _HomeState extends State<Home> {
child: const Text('Test Underlines'),
color: Colors.red.shade800,
textColor: Colors.white,
onPressed: () { Navigator.of(context).pushNamed('underlines'); },
onPressed: () { Navigator.pushNamed(context, 'underlines'); },
),
new FlatButton(
child: const Text('Test Font Fallback'),
color: Colors.orange.shade700,
textColor: Colors.white,
onPressed: () { Navigator.of(context).pushNamed('fallback'); },
onPressed: () { Navigator.pushNamed(context, 'fallback'); },
),
new FlatButton(
child: const Text('Test Bidi Formatting'),
color: Colors.yellow.shade700,
textColor: Colors.black,
onPressed: () { Navigator.of(context).pushNamed('bidi'); },
onPressed: () { Navigator.pushNamed(context, 'bidi'); },
),
new FlatButton(
child: const Text('TextSpan Fuzzer'),
color: Colors.green.shade400,
textColor: Colors.black,
onPressed: () { Navigator.of(context).pushNamed('fuzzer'); },
onPressed: () { Navigator.pushNamed(context, 'fuzzer'); },
),
new FlatButton(
child: const Text('Diacritics Fuzzer'),
color: Colors.blue.shade400,
textColor: Colors.white,
onPressed: () { Navigator.of(context).pushNamed('zalgo'); },
onPressed: () { Navigator.pushNamed(context, 'zalgo'); },
),
new FlatButton(
child: const Text('Painting Fuzzer'),
color: Colors.purple.shade200,
textColor: Colors.black,
onPressed: () { Navigator.of(context).pushNamed('painting'); },
onPressed: () { Navigator.pushNamed(context, 'painting'); },
),
],
),