Index: sky/examples/stocks2/lib/stock_app.dart |
diff --git a/sky/examples/stocks2/lib/stock_app.dart b/sky/examples/stocks2/lib/stock_app.dart |
index 1c450b02682fb75f735bc53d954cc653f201783e..1586b173553641236dc98eba56414eb8b965827a 100644 |
--- a/sky/examples/stocks2/lib/stock_app.dart |
+++ b/sky/examples/stocks2/lib/stock_app.dart |
@@ -14,19 +14,24 @@ class StocksApp extends App { |
StocksApp({ RenderView renderViewOverride }) : super(renderViewOverride: renderViewOverride); |
+ NavigationState _navState = new NavigationState([ |
+ new Route(name: '/', builder: (navigator) => new StockHome(navigator)), |
+ new Route(name: '/settings', builder: (navigator) => new StockSettings(navigator)), |
+ ]); |
+ |
+ void onBack() { |
+ if (_navState.hasPrevious()) { |
+ setState(() { |
+ _navState.pop(); |
+ }); |
+ return; |
+ } |
+ print ("Should exit app here"); |
+ // TODO(jackson): Need a way to invoke default back behavior here |
+ } |
+ |
Widget build() { |
- return new Navigator( |
- routes: [ |
- new Route( |
- name: '/', |
- builder: (navigator) => new StockHome(navigator) |
- ), |
- new Route( |
- name: '/settings', |
- builder: (navigator) => new StockSettings(navigator) |
- ), |
- ] |
- ); |
+ return new Navigator(_navState); |
} |
} |