| 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/icon_button.dart'; | 10 import 'package:sky/framework/components/icon_button.dart'; |
| 11 import 'package:sky/framework/components/input.dart'; | 11 import 'package:sky/framework/components/input.dart'; |
| 12 import 'package:sky/framework/components/menu_divider.dart'; | 12 import 'package:sky/framework/components/menu_divider.dart'; |
| 13 import 'package:sky/framework/components/menu_item.dart'; | 13 import 'package:sky/framework/components/menu_item.dart'; |
| 14 import 'package:sky/framework/components/modal_overlay.dart'; | 14 import 'package:sky/framework/components/modal_overlay.dart'; |
| 15 import 'package:sky/framework/components/popup_menu.dart'; | 15 import 'package:sky/framework/components/popup_menu.dart'; |
| 16 import 'package:sky/framework/components/scaffold.dart'; | 16 import 'package:sky/framework/components/scaffold.dart'; |
| 17 import 'package:sky/framework/debug/tracing.dart'; | |
| 18 import 'package:sky/framework/fn.dart'; | 17 import 'package:sky/framework/fn.dart'; |
| 19 import 'package:sky/framework/theme/typography.dart' as typography; | 18 import 'package:sky/framework/theme/typography.dart' as typography; |
| 20 import 'package:sky/framework/theme/colors.dart'; | 19 import 'package:sky/framework/theme/colors.dart'; |
| 21 import 'stock_data.dart'; | 20 import 'stock_data.dart'; |
| 22 import 'stock_list.dart'; | 21 import 'stock_list.dart'; |
| 23 import 'stock_menu.dart'; | 22 import 'stock_menu.dart'; |
| 24 | 23 |
| 25 class StocksApp extends App { | 24 class StocksApp extends App { |
| 26 DrawerController _drawerController = new DrawerController(); | 25 DrawerController _drawerController = new DrawerController(); |
| 27 PopupMenuController _menuController; | 26 PopupMenuController _menuController; |
| 28 | 27 |
| 29 static final Style _actionBarStyle = new Style(''' | 28 static final Style _actionBarStyle = new Style(''' |
| 30 background-color: ${Purple[500]};'''); | 29 background-color: ${Purple[500]};'''); |
| 31 | 30 |
| 32 static final Style _searchBarStyle = new Style(''' | 31 static final Style _searchBarStyle = new Style(''' |
| 33 background-color: ${Grey[50]};'''); | 32 background-color: ${Grey[50]};'''); |
| 34 | 33 |
| 35 static final Style _titleStyle = new Style(''' | 34 static final Style _titleStyle = new Style(''' |
| 36 ${typography.white.title};'''); | 35 ${typography.white.title};'''); |
| 37 | 36 |
| 38 StockDataFetcher _stockDataFetcher; | |
| 39 List<Stock> _stocks = []; | 37 List<Stock> _stocks = []; |
| 40 bool _isSearching = false; | 38 bool _isSearching = false; |
| 41 bool _isShowingMenu = false; | |
| 42 String _searchQuery; | 39 String _searchQuery; |
| 43 | 40 |
| 44 StocksApp() : super() { | 41 StocksApp() : super() { |
| 45 _stockDataFetcher = new StockDataFetcher((StockData data) { | 42 new StockDataFetcher((StockData data) { |
| 46 setState(() { | 43 setState(() { |
| 47 data.appendTo(_stocks); | 44 data.appendTo(_stocks); |
| 48 }); | 45 }); |
| 49 }); | 46 }); |
| 50 } | 47 } |
| 51 | 48 |
| 52 void _handleSearchBegin(_) { | 49 void _handleSearchBegin(_) { |
| 53 setState(() { | 50 setState(() { |
| 54 _isSearching = true; | 51 _isSearching = true; |
| 55 }); | 52 }); |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 return new Scaffold( | 158 return new Scaffold( |
| 162 header: _isSearching ? buildSearchBar() : buildActionBar(), | 159 header: _isSearching ? buildSearchBar() : buildActionBar(), |
| 163 content: new Stocklist(stocks: _stocks, query: _searchQuery), | 160 content: new Stocklist(stocks: _stocks, query: _searchQuery), |
| 164 fab: new FloatingActionButton( | 161 fab: new FloatingActionButton( |
| 165 content: new Icon(type: 'content/add_white', size: 24), level: 3), | 162 content: new Icon(type: 'content/add_white', size: 24), level: 3), |
| 166 drawer: buildDrawer(), | 163 drawer: buildDrawer(), |
| 167 overlays: overlays | 164 overlays: overlays |
| 168 ); | 165 ); |
| 169 } | 166 } |
| 170 } | 167 } |
| OLD | NEW |