OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 import 'package:sky/rendering/sky_binding.dart'; | 5 import 'package:sky/rendering/sky_binding.dart'; |
6 import 'package:sky/widgets/basic.dart'; | 6 import 'package:sky/widgets/basic.dart'; |
7 import 'package:sky/widgets/navigator.dart'; | 7 import 'package:sky/widgets/navigator.dart'; |
8 import 'package:sky/widgets/widget.dart'; | 8 import 'package:sky/widgets/widget.dart'; |
9 | 9 |
10 import 'stock_data.dart'; | 10 import 'stock_data.dart'; |
11 import 'stock_home.dart'; | 11 import 'stock_home.dart'; |
12 import 'stock_settings.dart'; | 12 import 'stock_settings.dart'; |
13 | 13 |
14 class StocksApp extends App { | 14 class StocksApp extends App { |
15 | 15 |
16 StocksApp() { | 16 StocksApp() { |
17 _navigationState = new NavigationState([ | 17 _navigationState = new NavigationState([ |
18 new Route( | 18 new Route( |
19 name: '/', | 19 name: '/', |
20 builder: (navigator, route) => new StockHome(navigator, route, _stocks) | 20 builder: (navigator, route) => new StockHome(navigator, route, _stocks) |
21 ), | 21 ), |
22 new Route( | 22 new Route( |
23 name: '/settings', | 23 name: '/settings', |
24 builder: (navigator, route) => new StockSettings(navigator) | 24 builder: (navigator, route) => new StockSettings(navigator) |
25 ), | 25 ), |
26 ]); | 26 ]); |
27 } | 27 } |
28 | 28 |
29 void didMount() { | 29 void didMount() { |
| 30 super.didMount(); |
30 new StockDataFetcher((StockData data) { | 31 new StockDataFetcher((StockData data) { |
31 setState(() { | 32 setState(() { |
32 data.appendTo(_stocks); | 33 data.appendTo(_stocks); |
33 }); | 34 }); |
34 }); | 35 }); |
35 } | 36 } |
36 | 37 |
37 final List<Stock> _stocks = []; | 38 final List<Stock> _stocks = []; |
38 NavigationState _navigationState; | 39 NavigationState _navigationState; |
39 | 40 |
(...skipping 10 matching lines...) Expand all Loading... |
50 } | 51 } |
51 | 52 |
52 void main() { | 53 void main() { |
53 print("starting stocks app!"); | 54 print("starting stocks app!"); |
54 runApp(new StocksApp()); | 55 runApp(new StocksApp()); |
55 SkyBinding.instance.onFrame = () { | 56 SkyBinding.instance.onFrame = () { |
56 // uncomment this for debugging: | 57 // uncomment this for debugging: |
57 // SkyBinding.instance.debugDumpRenderTree(); | 58 // SkyBinding.instance.debugDumpRenderTree(); |
58 }; | 59 }; |
59 } | 60 } |
OLD | NEW |