| 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'; |
| 11 import 'package:sky/framework/components/menu_divider.dart'; | 11 import 'package:sky/framework/components/menu_divider.dart'; |
| 12 import 'package:sky/framework/components/menu_item.dart'; | 12 import 'package:sky/framework/components/menu_item.dart'; |
| 13 import 'package:sky/framework/components/popup_menu.dart'; | 13 import 'package:sky/framework/components/popup_menu.dart'; |
| 14 import 'package:sky/framework/components/scaffold.dart'; | 14 import 'package:sky/framework/components/scaffold.dart'; |
| 15 import 'package:sky/framework/fn.dart'; | 15 import 'package:sky/framework/fn.dart'; |
| 16 import 'package:sky/framework/theme/typography.dart' as typography; | 16 import 'package:sky/framework/theme/typography.dart' as typography; |
| 17 import 'package:sky/framework/tracing.dart'; |
| 17 import 'stock_data.dart'; | 18 import 'stock_data.dart'; |
| 18 import 'stock_list.dart'; | 19 import 'stock_list.dart'; |
| 19 import 'stock_menu.dart'; | 20 import 'stock_menu.dart'; |
| 20 | 21 |
| 21 class StocksApp extends App { | 22 class StocksApp extends App { |
| 22 | 23 |
| 23 DrawerController _drawerController = new DrawerController(); | 24 DrawerController _drawerController = new DrawerController(); |
| 24 PopupMenuController _menuController; | 25 PopupMenuController _menuController; |
| 25 | 26 |
| 26 static Style _iconStyle = new Style(''' | 27 static Style _iconStyle = new Style(''' |
| 27 padding: 8px;''' | 28 padding: 8px;''' |
| 28 ); | 29 ); |
| 29 | 30 |
| 30 static Style _titleStyle = new Style(''' | 31 static Style _titleStyle = new Style(''' |
| 31 padding-left: 24px; | 32 padding-left: 24px; |
| 32 flex: 1; | 33 flex: 1; |
| 33 ${typography.white.title};''' | 34 ${typography.white.title};''' |
| 34 ); | 35 ); |
| 35 | 36 |
| 36 List<Stock> _sortedStocks = []; | 37 List<Stock> _sortedStocks = []; |
| 37 bool _isSearching = false; | 38 bool _isSearching = false; |
| 38 bool _isShowingMenu = false; | 39 bool _isShowingMenu = false; |
| 39 String _searchQuery; | 40 String _searchQuery; |
| 40 | 41 |
| 41 StocksApp() : super() { | 42 StocksApp() : super() { |
| 42 fetchStockOracle().then((oracle) { | 43 fetchStockOracle().then((oracle) { |
| 43 setState(() { | 44 setState(() { |
| 44 _sortedStocks = oracle.stocks; | 45 _sortedStocks = oracle.stocks; |
| 45 _sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol)); | 46 trace('StocksApp::sortStocks', () { |
| 47 _sortedStocks.sort((a, b) => a.symbol.compareTo(b.symbol)); |
| 48 }); |
| 46 }); | 49 }); |
| 47 }); | 50 }); |
| 48 } | 51 } |
| 49 | 52 |
| 50 void _handleSearchClick(_) { | 53 void _handleSearchClick(_) { |
| 51 setState(() { | 54 setState(() { |
| 52 _isSearching = !_isSearching; | 55 _isSearching = !_isSearching; |
| 53 }); | 56 }); |
| 54 } | 57 } |
| 55 | 58 |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 return new Scaffold( | 156 return new Scaffold( |
| 154 actionBar: actionBar, | 157 actionBar: actionBar, |
| 155 content: new Stocklist(stocks: _sortedStocks, query: _searchQuery), | 158 content: new Stocklist(stocks: _sortedStocks, query: _searchQuery), |
| 156 fab: new FloatingActionButton( | 159 fab: new FloatingActionButton( |
| 157 content: new Icon(type: 'content/add_white', size: 24), level: 3), | 160 content: new Icon(type: 'content/add_white', size: 24), level: 3), |
| 158 drawer: drawer, | 161 drawer: drawer, |
| 159 overlays: overlays | 162 overlays: overlays |
| 160 ); | 163 ); |
| 161 } | 164 } |
| 162 } | 165 } |
| OLD | NEW |