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/components2/tool_bar.dart'; | 5 import 'package:sky/framework/components2/tool_bar.dart'; |
6 import 'package:sky/framework/components2/drawer.dart'; | 6 import 'package:sky/framework/components2/drawer.dart'; |
7 // import 'package:sky/framework/components2/drawer_header.dart'; | 7 // import 'package:sky/framework/components2/drawer_header.dart'; |
8 // import 'package:sky/framework/components2/floating_action_button.dart'; | 8 // import 'package:sky/framework/components2/floating_action_button.dart'; |
9 // import 'package:sky/framework/components2/icon.dart'; | 9 // import 'package:sky/framework/components2/icon.dart'; |
10 import 'package:sky/framework/components2/icon_button.dart'; | 10 import 'package:sky/framework/components2/icon_button.dart'; |
11 // import 'package:sky/framework/components2/input.dart'; | |
12 import 'package:sky/framework/components2/menu_divider.dart'; | 11 import 'package:sky/framework/components2/menu_divider.dart'; |
13 import 'package:sky/framework/components2/menu_item.dart'; | 12 import 'package:sky/framework/components2/menu_item.dart'; |
| 13 import 'package:sky/framework/components2/input.dart'; |
14 // import 'package:sky/framework/components2/modal_overlay.dart'; | 14 // import 'package:sky/framework/components2/modal_overlay.dart'; |
15 // import 'package:sky/framework/components2/popup_menu.dart'; | 15 // import 'package:sky/framework/components2/popup_menu.dart'; |
16 // import 'package:sky/framework/components2/radio.dart'; | 16 // import 'package:sky/framework/components2/radio.dart'; |
17 import 'package:sky/framework/components2/scaffold.dart'; | 17 import 'package:sky/framework/components2/scaffold.dart'; |
18 import 'package:sky/framework/fn2.dart'; | 18 import 'package:sky/framework/fn2.dart'; |
19 import 'package:sky/framework/theme2/typography.dart' as typography; | 19 import 'package:sky/framework/theme2/typography.dart' as typography; |
20 import 'package:sky/framework/theme2/colors.dart' as colors; | 20 import 'package:sky/framework/theme2/colors.dart' as colors; |
21 import 'stock_data.dart'; | 21 import 'stock_data.dart'; |
22 import 'package:sky/framework/rendering/box.dart'; | 22 import 'package:sky/framework/rendering/box.dart'; |
23 // import 'stock_list.dart'; | 23 // import 'stock_list.dart'; |
24 // import 'stock_menu.dart'; | 24 // import 'stock_menu.dart'; |
25 | 25 |
26 import 'dart:async'; | 26 import 'dart:async'; |
27 import 'dart:sky' as sky; | 27 import 'dart:sky' as sky; |
28 | 28 |
29 enum StockMode { optimistic, pessimistic } | 29 enum StockMode { optimistic, pessimistic } |
30 | 30 |
31 class StocksApp extends App { | 31 class StocksApp extends App { |
32 | 32 |
33 // static final Style _searchBarStyle = new Style(''' | |
34 // background-color: ${Grey[50]};'''); | |
35 | |
36 // static final Style _titleStyle = new Style(''' | 33 // static final Style _titleStyle = new Style(''' |
37 // ${typography.white.title};'''); | 34 // ${typography.white.title};'''); |
38 | 35 |
39 List<Stock> _stocks = []; | 36 List<Stock> _stocks = []; |
40 | 37 |
41 StocksApp() : super() { | 38 StocksApp() : super() { |
42 // if (debug) | 39 // if (debug) |
43 // new Timer(new Duration(seconds: 1), dumpState); | 40 // new Timer(new Duration(seconds: 1), dumpState); |
44 new StockDataFetcher((StockData data) { | 41 new StockDataFetcher((StockData data) { |
45 setState(() { | 42 setState(() { |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 new IconButton( | 169 new IconButton( |
173 icon: 'navigation/more_vert_white', | 170 icon: 'navigation/more_vert_white', |
174 onGestureTap: _handleMenuShow) | 171 onGestureTap: _handleMenuShow) |
175 ], | 172 ], |
176 backgroundColor: colors.Purple[500] | 173 backgroundColor: colors.Purple[500] |
177 ); | 174 ); |
178 } | 175 } |
179 | 176 |
180 // TODO(abarth): Should we factor this into a SearchBar in the framework? | 177 // TODO(abarth): Should we factor this into a SearchBar in the framework? |
181 UINode buildSearchBar() { | 178 UINode buildSearchBar() { |
182 // return new StyleNode( | 179 return new ToolBar( |
183 // new ToolBar( | 180 left: new IconButton( |
184 // left: new IconButton( | 181 icon: 'navigation/arrow_back_grey600', |
185 // icon: 'navigation/arrow_back_grey600', | 182 onGestureTap: _handleSearchEnd), |
186 // onGestureTap: _handleSearchEnd), | 183 center: new Input( |
187 // center: new Input( | 184 focused: true, |
188 // focused: true, | 185 placeholder: 'Search stocks', |
189 // placeholder: 'Search stocks', | 186 onChanged: _handleSearchQueryChanged), |
190 // onChanged: _handleSearchQueryChanged)), | 187 backgroundColor: colors.Grey[50] |
191 // _searchBarStyle); | 188 ); |
192 } | 189 } |
193 | 190 |
194 void addMenuToOverlays(List<UINode> overlays) { | 191 void addMenuToOverlays(List<UINode> overlays) { |
195 // if (_menuController == null) | 192 // if (_menuController == null) |
196 // return; | 193 // return; |
197 // overlays.add(new ModalOverlay( | 194 // overlays.add(new ModalOverlay( |
198 // children: [new StockMenu( | 195 // children: [new StockMenu( |
199 // controller: _menuController, | 196 // controller: _menuController, |
200 // autorefresh: _autorefresh, | 197 // autorefresh: _autorefresh, |
201 // onAutorefreshChanged: _handleAutorefreshChanged | 198 // onAutorefreshChanged: _handleAutorefreshChanged |
(...skipping 14 matching lines...) Expand all Loading... |
216 ]; | 213 ]; |
217 addMenuToOverlays(overlays); | 214 addMenuToOverlays(overlays); |
218 return new StackContainer(children: overlays); | 215 return new StackContainer(children: overlays); |
219 } | 216 } |
220 } | 217 } |
221 | 218 |
222 void main() { | 219 void main() { |
223 print("starting stocks app!"); | 220 print("starting stocks app!"); |
224 new StocksApp(); | 221 new StocksApp(); |
225 } | 222 } |
OLD | NEW |