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

Side by Side Diff: sky/sdk/example/stocks/lib/stock_home.dart

Issue 1235443002: Support for icon theming (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: fix analyzer warning Created 5 years, 5 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 | « sky/sdk/example/stocks/lib/main.dart ('k') | sky/sdk/example/widgets/tabs.dart » ('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/editing/input.dart'; 5 import 'package:sky/editing/input.dart';
6 import 'package:sky/animation/animation_performance.dart'; 6 import 'package:sky/animation/animation_performance.dart';
7 import 'package:sky/widgets/animated_component.dart'; 7 import 'package:sky/widgets/animated_component.dart';
8 import 'package:sky/widgets/animated_container.dart'; 8 import 'package:sky/widgets/animated_container.dart';
9 import 'package:sky/theme/colors.dart' as colors;
9 import 'package:sky/widgets/basic.dart'; 10 import 'package:sky/widgets/basic.dart';
10 import 'package:sky/widgets/drawer.dart'; 11 import 'package:sky/widgets/drawer.dart';
11 import 'package:sky/widgets/drawer_header.dart'; 12 import 'package:sky/widgets/drawer_header.dart';
12 import 'package:sky/widgets/floating_action_button.dart'; 13 import 'package:sky/widgets/floating_action_button.dart';
13 import 'package:sky/widgets/icon.dart'; 14 import 'package:sky/widgets/icon.dart';
14 import 'package:sky/widgets/icon_button.dart'; 15 import 'package:sky/widgets/icon_button.dart';
15 import 'package:sky/widgets/menu_divider.dart'; 16 import 'package:sky/widgets/menu_divider.dart';
16 import 'package:sky/widgets/menu_item.dart'; 17 import 'package:sky/widgets/menu_item.dart';
17 import 'package:sky/widgets/modal_overlay.dart'; 18 import 'package:sky/widgets/modal_overlay.dart';
18 import 'package:sky/widgets/navigator.dart'; 19 import 'package:sky/widgets/navigator.dart';
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 stockMode = source.stockMode; 54 stockMode = source.stockMode;
54 modeUpdater = source.modeUpdater; 55 modeUpdater = source.modeUpdater;
55 } 56 }
56 57
57 bool _isSearching = false; 58 bool _isSearching = false;
58 String _searchQuery; 59 String _searchQuery;
59 60
60 AnimatedContainer _snackbarTransform; 61 AnimatedContainer _snackbarTransform;
61 62
62 void _handleSearchBegin() { 63 void _handleSearchBegin() {
64 navigator.pushState("/search", (_) {
65 setState(() {
66 _isSearching = false;
67 _searchQuery = null;
68 });
69 });
63 setState(() { 70 setState(() {
64 _isSearching = true; 71 _isSearching = true;
65 }); 72 });
66 } 73 }
67 74
68 void _handleSearchEnd() { 75 void _handleSearchEnd() {
76 assert(navigator.currentRoute.name == '/search');
77 navigator.pop();
78 assert(navigator.currentRoute.name == '/');
69 setState(() { 79 setState(() {
70 _isSearching = false; 80 _isSearching = false;
71 _searchQuery = null; 81 _searchQuery = null;
72 }); 82 });
73 } 83 }
74 84
75 void _handleSearchQueryChanged(String query) { 85 void _handleSearchQueryChanged(String query) {
76 setState(() { 86 setState(() {
77 _searchQuery = query; 87 _searchQuery = query;
78 }); 88 });
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 void _handleOpenDrawer() { 184 void _handleOpenDrawer() {
175 _drawerController.open(); 185 _drawerController.open();
176 navigator.pushState("/drawer", (_) { 186 navigator.pushState("/drawer", (_) {
177 _drawerController.close(); 187 _drawerController.close();
178 }); 188 });
179 } 189 }
180 190
181 Widget buildToolBar() { 191 Widget buildToolBar() {
182 return new ToolBar( 192 return new ToolBar(
183 left: new IconButton( 193 left: new IconButton(
184 icon: 'navigation/menu_white', 194 icon: "navigation/menu",
185 onPressed: _handleOpenDrawer), 195 onPressed: _handleOpenDrawer),
186 center: new Text('Stocks'), 196 center: new Text('Stocks'),
187 right: [ 197 right: [
188 new IconButton( 198 new IconButton(
189 icon: 'action/search_white', 199 icon: "action/search",
190 onPressed: _handleSearchBegin), 200 onPressed: _handleSearchBegin),
191 new IconButton( 201 new IconButton(
192 icon: 'navigation/more_vert_white', 202 icon: "navigation/more_vert",
193 onPressed: _handleMenuShow) 203 onPressed: _handleMenuShow)
194 ] 204 ]
195 ); 205 );
196 } 206 }
197 207
198 int selectedTabIndex = 0; 208 int selectedTabIndex = 0;
199 List<String> portfolioSymbols = ["AAPL","FIZZ", "FIVE", "FLAT", "ZINC", "ZNGA" ]; 209 List<String> portfolioSymbols = ["AAPL","FIZZ", "FIVE", "FLAT", "ZINC", "ZNGA" ];
200 210
201 Iterable<Stock> _filterByPortfolio(Iterable<Stock> stocks) { 211 Iterable<Stock> _filterByPortfolio(Iterable<Stock> stocks) {
202 return stocks.where((stock) => portfolioSymbols.contains(stock.symbol)); 212 return stocks.where((stock) => portfolioSymbols.contains(stock.symbol));
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 onChanged: (tabIndex) { 244 onChanged: (tabIndex) {
235 setState(() { selectedTabIndex = tabIndex; } ); 245 setState(() { selectedTabIndex = tabIndex; } );
236 } 246 }
237 ); 247 );
238 } 248 }
239 249
240 // TODO(abarth): Should we factor this into a SearchBar in the framework? 250 // TODO(abarth): Should we factor this into a SearchBar in the framework?
241 Widget buildSearchBar() { 251 Widget buildSearchBar() {
242 return new ToolBar( 252 return new ToolBar(
243 left: new IconButton( 253 left: new IconButton(
244 icon: 'navigation/arrow_back_grey600', 254 icon: "navigation/arrow_back",
245 onPressed: _handleSearchEnd), 255 onPressed: _handleSearchEnd),
246 center: new Input( 256 center: new Input(
247 focused: true, 257 focused: true,
248 placeholder: 'Search stocks', 258 placeholder: 'Search stocks',
249 onChanged: _handleSearchQueryChanged), 259 onChanged: _handleSearchQueryChanged),
250 backgroundColor: Theme.of(this).canvasColor 260 backgroundColor: Theme.of(this).canvasColor
251 ); 261 );
252 } 262 }
253 263
254 void _handleUndo() { 264 void _handleUndo() {
(...skipping 18 matching lines...) Expand all
273 ..position = new AnimatedType<Point>(const Point(0.0, 45.0), end: Point. origin); 283 ..position = new AnimatedType<Point>(const Point(0.0, 45.0), end: Point. origin);
274 var performance = _snackbarTransform.createPerformance( 284 var performance = _snackbarTransform.createPerformance(
275 [_snackbarTransform.position], duration: _kSnackbarSlideDuration); 285 [_snackbarTransform.position], duration: _kSnackbarSlideDuration);
276 watchPerformance(performance); 286 watchPerformance(performance);
277 performance.play(); 287 performance.play();
278 }); 288 });
279 } 289 }
280 290
281 Widget buildFloatingActionButton() { 291 Widget buildFloatingActionButton() {
282 var widget = new FloatingActionButton( 292 var widget = new FloatingActionButton(
283 child: new Icon(type: 'content/add_white', size: 24), 293 child: new Icon(type: 'content/add', size: 24),
294 backgroundColor: colors.RedAccent[200],
284 onPressed: _handleStockPurchased 295 onPressed: _handleStockPurchased
285 ); 296 );
286 if (_snackbarTransform != null) 297 if (_snackbarTransform != null)
287 widget = _snackbarTransform.build(widget); 298 widget = _snackbarTransform.build(widget);
288 return widget; 299 return widget;
289 } 300 }
290 301
291 void addMenuToOverlays(List<Widget> overlays) { 302 void addMenuToOverlays(List<Widget> overlays) {
292 if (_menuController == null) 303 if (_menuController == null)
293 return; 304 return;
(...skipping 13 matching lines...) Expand all
307 body: buildTabNavigator(), 318 body: buildTabNavigator(),
308 snackBar: buildSnackBar(), 319 snackBar: buildSnackBar(),
309 floatingActionButton: buildFloatingActionButton(), 320 floatingActionButton: buildFloatingActionButton(),
310 drawer: _drawerShowing ? buildDrawer() : null 321 drawer: _drawerShowing ? buildDrawer() : null
311 ), 322 ),
312 ]; 323 ];
313 addMenuToOverlays(overlays); 324 addMenuToOverlays(overlays);
314 return new Stack(overlays); 325 return new Stack(overlays);
315 } 326 }
316 } 327 }
OLDNEW
« no previous file with comments | « sky/sdk/example/stocks/lib/main.dart ('k') | sky/sdk/example/widgets/tabs.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698