Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(482)

Side by Side Diff: sky/examples/stocks/lib/stock_app.dart

Issue 1133353008: [Effen] Rename Action Bar to Tool Bar. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | sky/sdk/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/tool_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/radio.dart'; 16 import 'package:sky/framework/components/radio.dart';
17 import 'package:sky/framework/components/scaffold.dart'; 17 import 'package:sky/framework/components/scaffold.dart';
18 import 'package:sky/framework/fn.dart'; 18 import 'package:sky/framework/fn.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 'stock_list.dart'; 22 import 'stock_list.dart';
23 import 'stock_menu.dart'; 23 import 'stock_menu.dart';
24 24
25 import 'dart:async'; 25 import 'dart:async';
26 import 'package:sky/framework/layout.dart'; 26 import 'package:sky/framework/layout.dart';
27 27
28 const bool debug = false; // set to true to dump the DOM for debugging purposes 28 const bool debug = false; // set to true to dump the DOM for debugging purposes
29 29
30 enum StockMode { Optimistic, Pessimistic } 30 enum StockMode { Optimistic, Pessimistic }
31 31
32 class StocksApp extends App { 32 class StocksApp extends App {
33 33
34 static final Style _actionBarStyle = new Style(''' 34 static final Style _toolBarStyle = new Style('''
35 background-color: ${Purple[500]};'''); 35 background-color: ${Purple[500]};''');
36 36
37 static final Style _searchBarStyle = new Style(''' 37 static final Style _searchBarStyle = new Style('''
38 background-color: ${Grey[50]};'''); 38 background-color: ${Grey[50]};''');
39 39
40 static final Style _titleStyle = new Style(''' 40 static final Style _titleStyle = new Style('''
41 ${typography.white.title};'''); 41 ${typography.white.title};''');
42 42
43 List<Stock> _stocks = []; 43 List<Stock> _stocks = [];
44 44
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 icon: 'action/settings', 156 icon: 'action/settings',
157 children: [new Text('Settings')]), 157 children: [new Text('Settings')]),
158 new MenuItem( 158 new MenuItem(
159 key: 'Help & Feedback', 159 key: 'Help & Feedback',
160 icon: 'action/help', 160 icon: 'action/help',
161 children: [new Text('Help & Feedback')]) 161 children: [new Text('Help & Feedback')])
162 ] 162 ]
163 ); 163 );
164 } 164 }
165 165
166 UINode buildActionBar() { 166 UINode buildToolBar() {
167 return new StyleNode( 167 return new StyleNode(
168 new ActionBar( 168 new ToolBar(
169 left: new IconButton( 169 left: new IconButton(
170 icon: 'navigation/menu_white', 170 icon: 'navigation/menu_white',
171 onGestureTap: _drawerController.toggle), 171 onGestureTap: _drawerController.toggle),
172 center: new Container( 172 center: new Container(
173 style: _titleStyle, 173 style: _titleStyle,
174 children: [new Text('Stocks')]), 174 children: [new Text('Stocks')]),
175 right: [ 175 right: [
176 new IconButton( 176 new IconButton(
177 icon: 'action/search_white', 177 icon: 'action/search_white',
178 onGestureTap: _handleSearchBegin), 178 onGestureTap: _handleSearchBegin),
179 new IconButton( 179 new IconButton(
180 icon: 'navigation/more_vert_white', 180 icon: 'navigation/more_vert_white',
181 onGestureTap: _handleMenuShow) 181 onGestureTap: _handleMenuShow)
182 ]), 182 ]),
183 _actionBarStyle); 183 _toolBarStyle);
184 } 184 }
185 185
186 // TODO(abarth): Should we factor this into a SearchBar in the framework? 186 // TODO(abarth): Should we factor this into a SearchBar in the framework?
187 UINode buildSearchBar() { 187 UINode buildSearchBar() {
188 return new StyleNode( 188 return new StyleNode(
189 new ActionBar( 189 new ToolBar(
190 left: new IconButton( 190 left: new IconButton(
191 icon: 'navigation/arrow_back_grey600', 191 icon: 'navigation/arrow_back_grey600',
192 onGestureTap: _handleSearchEnd), 192 onGestureTap: _handleSearchEnd),
193 center: new Input( 193 center: new Input(
194 focused: true, 194 focused: true,
195 placeholder: 'Search stocks', 195 placeholder: 'Search stocks',
196 onChanged: _handleSearchQueryChanged)), 196 onChanged: _handleSearchQueryChanged)),
197 _searchBarStyle); 197 _searchBarStyle);
198 } 198 }
199 199
200 void addMenuToOverlays(List<UINode> overlays) { 200 void addMenuToOverlays(List<UINode> overlays) {
201 if (_menuController == null) 201 if (_menuController == null)
202 return; 202 return;
203 overlays.add(new ModalOverlay( 203 overlays.add(new ModalOverlay(
204 children: [new StockMenu( 204 children: [new StockMenu(
205 controller: _menuController, 205 controller: _menuController,
206 autorefresh: _autorefresh, 206 autorefresh: _autorefresh,
207 onAutorefreshChanged: _handleAutorefreshChanged 207 onAutorefreshChanged: _handleAutorefreshChanged
208 )], 208 )],
209 onDismiss: _handleMenuHide)); 209 onDismiss: _handleMenuHide));
210 } 210 }
211 211
212 UINode build() { 212 UINode build() {
213 List<UINode> overlays = []; 213 List<UINode> overlays = [];
214 addMenuToOverlays(overlays); 214 addMenuToOverlays(overlays);
215 215
216 return new Scaffold( 216 return new Scaffold(
217 header: _isSearching ? buildSearchBar() : buildActionBar(), 217 header: _isSearching ? buildSearchBar() : buildToolBar(),
218 content: new Stocklist(stocks: _stocks, query: _searchQuery), 218 content: new Stocklist(stocks: _stocks, query: _searchQuery),
219 fab: new FloatingActionButton( 219 fab: new FloatingActionButton(
220 content: new Icon(type: 'content/add_white', size: 24), level: 3), 220 content: new Icon(type: 'content/add_white', size: 24), level: 3),
221 drawer: _drawerShowing ? buildDrawer() : null, 221 drawer: _drawerShowing ? buildDrawer() : null,
222 overlays: overlays 222 overlays: overlays
223 ); 223 );
224 } 224 }
225 } 225 }
OLDNEW
« no previous file with comments | « no previous file | sky/sdk/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698