Simplify the usage of Navigator's routes argument (These are changes cherry-picked from in-flight branches since they are more independent and could be helpful even without those changes.) - Change RouteBuilder's signature to take a single argument in which the other fields are placed, so that we can keep iterating on those arguments without having to break compatibility each time. Also, this makes defining route builders much simpler (only one argument to ignore rather than a variable number). - Expose the next performance to RouteBuilders, since sometimes the route itself might not be where it's used. - Allow BuildContext to be used to walk children, just like it can for ancestors - Allow BuildContext to be used to get the Widget of the current BuildContext - Allow StatefulComponentElement to be referenced with a type specialisation so that you don't have to cast when you know what the type you're dealing with actually is.
diff --git a/examples/game/example_effect_line.dart b/examples/game/example_effect_line.dart index 4a6e7cc..05323d0 100644 --- a/examples/game/example_effect_line.dart +++ b/examples/game/example_effect_line.dart
@@ -62,7 +62,7 @@ ); } - Column _buildColumn(NavigatorState navigator, Route route) { + Column _buildColumn(RouteArguments args) { return new Column([ new Flexible(child: _buildSpriteWidget()), _buildTabBar()
diff --git a/examples/game/lib/main.dart b/examples/game/lib/main.dart index a93038d..2cb407a 100644 --- a/examples/game/lib/main.dart +++ b/examples/game/lib/main.dart
@@ -92,11 +92,11 @@ ); } - Widget _buildGameScene(NavigatorState navigator, Route route) { + Widget _buildGameScene(RouteArguments args) { return new SpriteWidget(_game, SpriteBoxTransformMode.fixedWidth); } - Widget _buildMainScene(navigator, route) { + Widget _buildMainScene(RouteArguments args) { return new Stack([ new SpriteWidget(new MainScreenBackground(), SpriteBoxTransformMode.fixedWidth), new Column([ @@ -109,10 +109,10 @@ _sounds, (lastScore) { setState(() {_lastScore = lastScore;}); - navigator.pop(); + args.navigator.pop(); } ); - navigator.pushNamed('/game'); + args.navigator.pushNamed('/game'); }, texture: _spriteSheetUI['btn_play_up.png'], textureDown: _spriteSheetUI['btn_play_down.png'],
diff --git a/examples/game/test_drawatlas.dart b/examples/game/test_drawatlas.dart index 135334e..dba1748 100644 --- a/examples/game/test_drawatlas.dart +++ b/examples/game/test_drawatlas.dart
@@ -36,7 +36,7 @@ title: 'Test drawAtlas', theme: _theme, routes: { - '/': (NavigatorState navigator, Route route) { + '/': (RouteArguments args) { return new SpriteWidget( new TestDrawAtlas(), SpriteBoxTransformMode.fixedWidth
diff --git a/examples/game/test_physics.dart b/examples/game/test_physics.dart index 2a9ad88..aabb773 100644 --- a/examples/game/test_physics.dart +++ b/examples/game/test_physics.dart
@@ -34,7 +34,7 @@ primarySwatch: Colors.purple ), routes: { - '/': (navigator, route) { + '/': (RouteArguments args) { return new SpriteWidget( new TestBed(), SpriteBoxTransformMode.letterbox