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'; |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 icon: 'action/settings', | 105 icon: 'action/settings', |
106 children: [new Text('Settings')]), | 106 children: [new Text('Settings')]), |
107 new MenuItem( | 107 new MenuItem( |
108 key: 'Help & Feedback', | 108 key: 'Help & Feedback', |
109 icon: 'action/help', | 109 icon: 'action/help', |
110 children: [new Text('Help & Feedback')]) | 110 children: [new Text('Help & Feedback')]) |
111 ] | 111 ] |
112 ); | 112 ); |
113 } | 113 } |
114 | 114 |
115 Node buildActionBar() { | 115 UINode buildActionBar() { |
116 return new StyleNode( | 116 return new StyleNode( |
117 new ActionBar( | 117 new ActionBar( |
118 left: new IconButton( | 118 left: new IconButton( |
119 icon: 'navigation/menu_white', | 119 icon: 'navigation/menu_white', |
120 onGestureTap: _drawerController.toggle), | 120 onGestureTap: _drawerController.toggle), |
121 center: new Container( | 121 center: new Container( |
122 style: _titleStyle, | 122 style: _titleStyle, |
123 children: [new Text('Stocks')]), | 123 children: [new Text('Stocks')]), |
124 right: [ | 124 right: [ |
125 new IconButton( | 125 new IconButton( |
126 icon: 'action/search_white', | 126 icon: 'action/search_white', |
127 onGestureTap: _handleSearchBegin), | 127 onGestureTap: _handleSearchBegin), |
128 new IconButton( | 128 new IconButton( |
129 icon: 'navigation/more_vert_white', | 129 icon: 'navigation/more_vert_white', |
130 onGestureTap: _handleMenuShow) | 130 onGestureTap: _handleMenuShow) |
131 ]), | 131 ]), |
132 _actionBarStyle); | 132 _actionBarStyle); |
133 } | 133 } |
134 | 134 |
135 // TODO(abarth): Should we factor this into a SearchBar in the framework? | 135 // TODO(abarth): Should we factor this into a SearchBar in the framework? |
136 Node buildSearchBar() { | 136 UINode buildSearchBar() { |
137 return new StyleNode( | 137 return new StyleNode( |
138 new ActionBar( | 138 new ActionBar( |
139 left: new IconButton( | 139 left: new IconButton( |
140 icon: 'navigation/arrow_back_grey600', | 140 icon: 'navigation/arrow_back_grey600', |
141 onGestureTap: _handleSearchEnd), | 141 onGestureTap: _handleSearchEnd), |
142 center: new Input( | 142 center: new Input( |
143 focused: true, | 143 focused: true, |
144 placeholder: 'Search stocks', | 144 placeholder: 'Search stocks', |
145 onChanged: _handleSearchQueryChanged)), | 145 onChanged: _handleSearchQueryChanged)), |
146 _searchBarStyle); | 146 _searchBarStyle); |
147 } | 147 } |
148 | 148 |
149 void addMenuToOverlays(List<Node> overlays) { | 149 void addMenuToOverlays(List<UINode> overlays) { |
150 if (_menuController == null) | 150 if (_menuController == null) |
151 return; | 151 return; |
152 overlays.add(new ModalOverlay( | 152 overlays.add(new ModalOverlay( |
153 children: [new StockMenu(controller: _menuController)], | 153 children: [new StockMenu(controller: _menuController)], |
154 onDismiss: _handleMenuHide)); | 154 onDismiss: _handleMenuHide)); |
155 } | 155 } |
156 | 156 |
157 Node build() { | 157 UINode build() { |
158 List<Node> overlays = []; | 158 List<UINode> overlays = []; |
159 addMenuToOverlays(overlays); | 159 addMenuToOverlays(overlays); |
160 | 160 |
161 return new Scaffold( | 161 return new Scaffold( |
162 header: _isSearching ? buildSearchBar() : buildActionBar(), | 162 header: _isSearching ? buildSearchBar() : buildActionBar(), |
163 content: new Stocklist(stocks: _stocks, query: _searchQuery), | 163 content: new Stocklist(stocks: _stocks, query: _searchQuery), |
164 fab: new FloatingActionButton( | 164 fab: new FloatingActionButton( |
165 content: new Icon(type: 'content/add_white', size: 24), level: 3), | 165 content: new Icon(type: 'content/add_white', size: 24), level: 3), |
166 drawer: buildDrawer(), | 166 drawer: buildDrawer(), |
167 overlays: overlays | 167 overlays: overlays |
168 ); | 168 ); |
169 } | 169 } |
170 } | 170 } |
OLD | NEW |