| 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/framework/components/action_bar.dart'; | 5 import 'package:sky/framework/components/action_bar.dart'; |
| 6 import 'package:sky/framework/components/drawer.dart'; | 6 import 'package:sky/framework/components/drawer.dart'; |
| 7 import 'package:sky/framework/components/drawer_header.dart'; | 7 import 'package:sky/framework/components/drawer_header.dart'; |
| 8 import 'package:sky/framework/components/floating_action_button.dart'; | 8 import 'package:sky/framework/components/floating_action_button.dart'; |
| 9 import 'package:sky/framework/components/icon.dart'; | 9 import 'package:sky/framework/components/icon.dart'; |
| 10 import 'package:sky/framework/components/input.dart'; | 10 import 'package:sky/framework/components/input.dart'; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 static Style _iconStyle = new Style(''' | 26 static Style _iconStyle = new Style(''' |
| 27 padding: 8px;''' | 27 padding: 8px;''' |
| 28 ); | 28 ); |
| 29 | 29 |
| 30 static Style _titleStyle = new Style(''' | 30 static Style _titleStyle = new Style(''' |
| 31 padding-left: 24px; | 31 padding-left: 24px; |
| 32 flex: 1; | 32 flex: 1; |
| 33 ${typography.white.title};''' | 33 ${typography.white.title};''' |
| 34 ); | 34 ); |
| 35 | 35 |
| 36 List<Stock> _sortedStocks; | 36 List<Stock> _sortedStocks = []; |
| 37 bool _isSearching = false; | 37 bool _isSearching = false; |
| 38 bool _isShowingMenu = false; | 38 bool _isShowingMenu = false; |
| 39 String _searchQuery; | 39 String _searchQuery; |
| 40 | 40 |
| 41 StocksApp() : super() { | 41 StocksApp() : super() { |
| 42 _sortedStocks = oracle.stocks; | 42 fetchStockOracle().then((oracle) { |
| 43 _sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol)); | 43 setState(() { |
| 44 _sortedStocks = oracle.stocks; |
| 45 _sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol)); |
| 46 }); |
| 47 }); |
| 44 } | 48 } |
| 45 | 49 |
| 46 void _handleSearchClick(_) { | 50 void _handleSearchClick(_) { |
| 47 setState(() { | 51 setState(() { |
| 48 _isSearching = !_isSearching; | 52 _isSearching = !_isSearching; |
| 49 }); | 53 }); |
| 50 } | 54 } |
| 51 | 55 |
| 52 void _handleMenuClick(_) { | 56 void _handleMenuClick(_) { |
| 53 setState(() { | 57 setState(() { |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 return new Scaffold( | 153 return new Scaffold( |
| 150 actionBar: actionBar, | 154 actionBar: actionBar, |
| 151 content: new Stocklist(stocks: _sortedStocks, query: _searchQuery), | 155 content: new Stocklist(stocks: _sortedStocks, query: _searchQuery), |
| 152 fab: new FloatingActionButton( | 156 fab: new FloatingActionButton( |
| 153 content: new Icon(type: 'content/add_white', size: 24), level: 3), | 157 content: new Icon(type: 'content/add_white', size: 24), level: 3), |
| 154 drawer: drawer, | 158 drawer: drawer, |
| 155 overlays: overlays | 159 overlays: overlays |
| 156 ); | 160 ); |
| 157 } | 161 } |
| 158 } | 162 } |
| OLD | NEW |