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 6ed6dd4a1ce35036045b0117d843ae011136b1ac..2398238cd43c3faa709257f87b66a984c1822215 100644 |
--- a/sky/examples/stocks2/lib/stock_app.dart |
+++ b/sky/examples/stocks2/lib/stock_app.dart |
@@ -7,29 +7,45 @@ import 'package:sky/widgets/basic.dart'; |
import 'package:sky/widgets/navigator.dart'; |
import 'package:sky/widgets/widget.dart'; |
+import 'stock_data.dart'; |
import 'stock_home.dart'; |
import 'stock_settings.dart'; |
class StocksApp extends App { |
- NavigationState _navState = new NavigationState([ |
- new Route(name: '/', builder: (navigator) => new StockHome(navigator)), |
- new Route(name: '/settings', builder: (navigator) => new StockSettings(navigator)), |
- ]); |
+ StocksApp() { |
+ _navigationState = new NavigationState([ |
+ new Route( |
+ name: '/', |
+ builder: (navigator, route) => new StockHome(navigator, route, _stocks) |
+ ), |
+ new Route( |
+ name: '/settings', |
+ builder: (navigator, route) => new StockSettings(navigator) |
+ ), |
+ ]); |
+ } |
- void onBack() { |
- if (_navState.hasPrevious()) { |
+ void didMount() { |
+ new StockDataFetcher((StockData data) { |
setState(() { |
- _navState.pop(); |
+ data.appendTo(_stocks); |
}); |
- return; |
- } |
- print ("Should exit app here"); |
+ }); |
+ } |
+ |
+ final List<Stock> _stocks = []; |
+ NavigationState _navigationState; |
+ |
+ void onBack() { |
+ setState(() { |
+ _navigationState.pop(); |
+ }); |
// TODO(jackson): Need a way to invoke default back behavior here |
} |
Widget build() { |
- return new Navigator(_navState); |
+ return new Navigator(_navigationState); |
} |
} |