Chromium Code Reviews| 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'; | 11 // import 'package:sky/framework/components2/input.dart'; |
| 12 // import 'package:sky/framework/components2/menu_divider.dart'; | 12 // import 'package:sky/framework/components2/menu_divider.dart'; |
| 13 // import 'package:sky/framework/components2/menu_item.dart'; | 13 // import 'package:sky/framework/components2/menu_item.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/theme/typography.dart' as typography; | 19 import 'package:sky/framework/theme/typography.dart' as typography; |
| 20 import 'package:sky/framework/theme/colors.dart'; | 20 import 'package:sky/framework/theme/colors.dart'; |
| 21 import 'stock_data.dart'; | 21 import 'stock_data.dart'; |
| 22 import 'package:sky/framework/rendering/box.dart'; | |
| 22 // import 'stock_list.dart'; | 23 // import 'stock_list.dart'; |
| 23 // import 'stock_menu.dart'; | 24 // import 'stock_menu.dart'; |
| 24 | 25 |
| 25 import 'dart:async'; | 26 import 'dart:async'; |
| 27 import 'dart:sky' as sky; | |
| 26 | 28 |
| 27 enum StockMode { Optimistic, Pessimistic } | 29 enum StockMode { Optimistic, Pessimistic } |
| 28 | 30 |
| 29 class StocksApp extends App { | 31 class StocksApp extends App { |
| 30 | 32 |
| 31 // static final Style _toolBarStyle = new Style(''' | |
| 32 // background-color: ${Purple[500]};'''); | |
| 33 | |
| 34 // static final Style _searchBarStyle = new Style(''' | 33 // static final Style _searchBarStyle = new Style(''' |
| 35 // background-color: ${Grey[50]};'''); | 34 // background-color: ${Grey[50]};'''); |
| 36 | 35 |
| 37 // static final Style _titleStyle = new Style(''' | 36 // static final Style _titleStyle = new Style(''' |
| 38 // ${typography.white.title};'''); | 37 // ${typography.white.title};'''); |
| 39 | 38 |
| 40 List<Stock> _stocks = []; | 39 List<Stock> _stocks = []; |
| 41 | 40 |
| 42 StocksApp() : super() { | 41 StocksApp() : super() { |
| 43 // if (debug) | 42 // if (debug) |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 154 // children: [new Text('Settings')]), | 153 // children: [new Text('Settings')]), |
| 155 // new MenuItem( | 154 // new MenuItem( |
| 156 // key: 'Help & Feedback', | 155 // key: 'Help & Feedback', |
| 157 // icon: 'action/help', | 156 // icon: 'action/help', |
| 158 // children: [new Text('Help & Feedback')]) | 157 // children: [new Text('Help & Feedback')]) |
| 159 // ] | 158 // ] |
| 160 // ); | 159 // ); |
| 161 // } | 160 // } |
| 162 | 161 |
| 163 UINode buildToolBar() { | 162 UINode buildToolBar() { |
| 164 return new Rectangle(0xFF00FF00); | 163 return new ToolBar( |
| 165 // return new StyleNode( | 164 left: new IconButton( |
| 166 // new ToolBar( | 165 icon: 'navigation/menu_white', |
| 167 // left: new IconButton( | 166 onGestureTap: (_) => true), // _drawerController.toggle), |
| 168 // icon: 'navigation/menu_white', | 167 center: new Text('Stocks'), |
|
Hixie
2015/06/03 17:31:41
Add a comment here referencing _titleStyle, so we
| |
| 169 // onGestureTap: _drawerController.toggle), | 168 right: [ |
| 170 // center: new Container( | 169 new IconButton( |
| 171 // style: _titleStyle, | 170 icon: 'action/search_white', |
| 172 // children: [new Text('Stocks')]), | 171 onGestureTap: _handleSearchBegin), |
| 173 // right: [ | 172 new IconButton( |
| 174 // new IconButton( | 173 icon: 'navigation/more_vert_white', |
| 175 // icon: 'action/search_white', | 174 onGestureTap: _handleMenuShow) |
| 176 // onGestureTap: _handleSearchBegin), | 175 ], |
| 177 // new IconButton( | 176 backgroundColor: colorFromCSSHexColorString(Purple[500]) |
| 178 // icon: 'navigation/more_vert_white', | 177 ); |
| 179 // onGestureTap: _handleMenuShow) | |
| 180 // ]), | |
| 181 // _toolBarStyle); | |
| 182 } | 178 } |
| 183 | 179 |
| 184 // TODO(abarth): Should we factor this into a SearchBar in the framework? | 180 // TODO(abarth): Should we factor this into a SearchBar in the framework? |
| 185 UINode buildSearchBar() { | 181 UINode buildSearchBar() { |
| 186 // return new StyleNode( | 182 // return new StyleNode( |
| 187 // new ToolBar( | 183 // new ToolBar( |
| 188 // left: new IconButton( | 184 // left: new IconButton( |
| 189 // icon: 'navigation/arrow_back_grey600', | 185 // icon: 'navigation/arrow_back_grey600', |
| 190 // onGestureTap: _handleSearchEnd), | 186 // onGestureTap: _handleSearchEnd), |
| 191 // center: new Input( | 187 // center: new Input( |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 203 // controller: _menuController, | 199 // controller: _menuController, |
| 204 // autorefresh: _autorefresh, | 200 // autorefresh: _autorefresh, |
| 205 // onAutorefreshChanged: _handleAutorefreshChanged | 201 // onAutorefreshChanged: _handleAutorefreshChanged |
| 206 // )], | 202 // )], |
| 207 // onDismiss: _handleMenuHide)); | 203 // onDismiss: _handleMenuHide)); |
| 208 // } | 204 // } |
| 209 | 205 |
| 210 UINode build() { | 206 UINode build() { |
| 211 // List<UINode> overlays = []; | 207 // List<UINode> overlays = []; |
| 212 // addMenuToOverlays(overlays); | 208 // addMenuToOverlays(overlays); |
| 209 return new Container( | |
| 210 child: new BlockContainer(children: [buildToolBar()]), | |
| 211 decoration: new BoxDecoration( | |
| 212 backgroundColor: 0xFFFFFFFF | |
| 213 ) | |
| 214 ); | |
| 213 | 215 |
| 214 return new Scaffold( | 216 // return new Scaffold( |
| 215 toolbar: _isSearching ? buildSearchBar() : buildToolBar() | 217 // toolbar: _isSearching ? buildSearchBar() : buildToolBar() |
| 216 // , | 218 // , |
| 217 // body: new Stocklist(stocks: _stocks, query: _searchQuery), | 219 // body: new Stocklist(stocks: _stocks, query: _searchQuery), |
| 218 // floatingActionButton: new FloatingActionButton( | 220 // floatingActionButton: new FloatingActionButton( |
| 219 // content: new Icon(type: 'content/add_white', size: 24), level: 3), | 221 // content: new Icon(type: 'content/add_white', size: 24), level: 3), |
| 220 // drawer: _drawerShowing ? buildDrawer() : null, | 222 // drawer: _drawerShowing ? buildDrawer() : null, |
| 221 // overlays: overlays | 223 // overlays: overlays |
| 222 ); | 224 // ); |
| 223 } | 225 } |
| 224 } | 226 } |
| 225 | 227 |
| 226 void main() { | 228 void main() { |
| 227 print("starting stocks app!"); | 229 print("starting stocks app!"); |
| 228 new StocksApp(); | 230 new StocksApp(); |
| 229 } | 231 } |
| OLD | NEW |