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

Side by Side Diff: sky/examples/fn/widgets/icon.dart

Issue 975863003: Don't hardcode the list of events types in fn (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: More careful event syncing Created 5 years, 9 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
OLDNEW
1 part of widgets; 1 part of widgets;
2 2
3 const String kAssetBase = '/sky/assets/material-design-icons'; 3 const String kAssetBase = '/sky/assets/material-design-icons';
4 4
5 class Icon extends Component { 5 class Icon extends Component {
6 6
7 Style style; 7 Style style;
8 int size; 8 int size;
9 String type; 9 String type;
10 sky.EventListener onClick;
11 10
12 Icon({ 11 Icon({
13 String key, 12 String key,
14 this.style, 13 this.style,
15 this.size, 14 this.size,
16 this.type: '', 15 this.type: ''
17 this.onClick
18 }) : super(key: key); 16 }) : super(key: key);
19 17
20 Node render() { 18 Node render() {
21 String category = ''; 19 String category = '';
22 String subtype = ''; 20 String subtype = '';
23 List<String> parts = type.split('/'); 21 List<String> parts = type.split('/');
24 if (parts.length == 2) { 22 if (parts.length == 2) {
25 category = parts[0]; 23 category = parts[0];
26 subtype = parts[1]; 24 subtype = parts[1];
27 } 25 }
28 26
29 return new Image( 27 return new Image(
30 style: style, 28 style: style,
31 onClick: onClick,
32 width: size, 29 width: size,
33 height: size, 30 height: size,
34 src: '${kAssetBase}/${category}/2x_web/ic_${subtype}_${size}dp.png' 31 src: '${kAssetBase}/${category}/2x_web/ic_${subtype}_${size}dp.png'
35 ); 32 );
36 } 33 }
37 } 34 }
OLDNEW
« no previous file with comments | « sky/examples/fn/widgets/fixedheightscrollable.dart ('k') | sky/examples/fn/widgets/material.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698