Track scroll position
- Change RouteArguments to pass the route's BuildContext rather than the Navigator. This caused the bulk of the examples/ and .../test/ changes (those are mostly mechanical changes). It also meant I could simplify Navigator.of(). - Make initState() actually get called when the State's Element is in the tree, so you can use Foo.of() functions there. Added a test for this also. - Provide a RouteWidget so that routes have a position in the Widget tree. The bulk of the route logic is still in a longer-lived Route object for now. - Make Route.setState() only rebuild the actual route, not the whole navigator. - Provided a Route.of(). - Provided a Route.writeState / Route.readState API that tries to identify the clients by their runtimeType, their key, and their ancestors keys, up to the nearest ancestor with a GlobalKey. - Made scrollables hook into this API to track state. Added a test to make sure this works. - Fix the debug output of GestureDetector and the hashCode of MixedViewport. - Fixed ScrollableWidgetListState<T> to handle infinite lists.
This commit is contained in:
@@ -108,10 +108,10 @@ class GameDemoState extends State<GameDemo> {
|
||||
_sounds,
|
||||
(int lastScore) {
|
||||
setState(() { _lastScore = lastScore; });
|
||||
args.navigator.pop();
|
||||
Navigator.of(args.context).pop();
|
||||
}
|
||||
);
|
||||
args.navigator.pushNamed('/game');
|
||||
Navigator.of(args.context).pushNamed('/game');
|
||||
},
|
||||
texture: _spriteSheetUI['btn_play_up.png'],
|
||||
textureDown: _spriteSheetUI['btn_play_down.png'],
|
||||
|
||||
Reference in New Issue
Block a user