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

Side by Side Diff: sky/sdk/lib/widgets/icon.dart

Issue 1226113007: Add @override annotation to known overriden methods (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: 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/lib/widgets/floating_action_button.dart ('k') | sky/sdk/lib/widgets/icon_button.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 '../mojo/asset_bundle.dart'; 5 import '../mojo/asset_bundle.dart';
6 import 'basic.dart'; 6 import 'basic.dart';
7 7
8 AssetBundle _initIconBundle() { 8 AssetBundle _initIconBundle() {
9 if (rootBundle != null) 9 if (rootBundle != null)
10 return rootBundle; 10 return rootBundle;
11 const String _kAssetBase = '/packages/sky/assets/material-design-icons/'; 11 const String _kAssetBase = '/packages/sky/assets/material-design-icons/';
12 return new NetworkAssetBundle(Uri.base.resolve(_kAssetBase)); 12 return new NetworkAssetBundle(Uri.base.resolve(_kAssetBase));
13 } 13 }
14 14
15 final AssetBundle _iconBundle = _initIconBundle(); 15 final AssetBundle _iconBundle = _initIconBundle();
16 16
17 class Icon extends Component { 17 class Icon extends Component {
18 Icon({ String key, this.size, this.type: '' }) : super(key: key); 18 Icon({ String key, this.size, this.type: '' }) : super(key: key);
19 19
20 final int size; 20 final int size;
21 final String type; 21 final String type;
22 22
23 @override
23 Widget build() { 24 Widget build() {
24 String category = ''; 25 String category = '';
25 String subtype = ''; 26 String subtype = '';
26 List<String> parts = type.split('/'); 27 List<String> parts = type.split('/');
27 if (parts.length == 2) { 28 if (parts.length == 2) {
28 category = parts[0]; 29 category = parts[0];
29 subtype = parts[1]; 30 subtype = parts[1];
30 } 31 }
31 // TODO(eseidel): This clearly isn't correct. Not sure what would be. 32 // TODO(eseidel): This clearly isn't correct. Not sure what would be.
32 // Should we use the ios images on ios? 33 // Should we use the ios images on ios?
33 String density = 'drawable-xxhdpi'; 34 String density = 'drawable-xxhdpi';
34 return new AssetImage( 35 return new AssetImage(
35 bundle: _iconBundle, 36 bundle: _iconBundle,
36 name: '${category}/${density}/ic_${subtype}_${size}dp.png', 37 name: '${category}/${density}/ic_${subtype}_${size}dp.png',
37 size: new Size(size.toDouble(), size.toDouble()) 38 size: new Size(size.toDouble(), size.toDouble())
38 ); 39 );
39 } 40 }
40 } 41 }
OLDNEW
« no previous file with comments | « sky/sdk/lib/widgets/floating_action_button.dart ('k') | sky/sdk/lib/widgets/icon_button.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698