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 '../fn.dart'; | 5 import '../fn.dart'; |
6 | 6 |
7 const String kAssetBase = '/sky/assets/material-design-icons'; | 7 const String kAssetBase = '/sky/assets/material-design-icons'; |
8 | 8 |
9 class Icon extends Component { | 9 class Icon extends Component { |
10 Style style; | 10 List<Style> styles; |
11 int size; | 11 int size; |
12 String type; | 12 String type; |
13 | 13 |
14 Icon({ | 14 Icon({ |
15 String key, | 15 String key, |
16 this.style, | 16 this.styles, |
17 this.size, | 17 this.size, |
18 this.type: '' | 18 this.type: '' |
19 }) : super(key: key); | 19 }) : super(key: key); |
20 | 20 |
21 Node build() { | 21 Node build() { |
22 String category = ''; | 22 String category = ''; |
23 String subtype = ''; | 23 String subtype = ''; |
24 List<String> parts = type.split('/'); | 24 List<String> parts = type.split('/'); |
25 if (parts.length == 2) { | 25 if (parts.length == 2) { |
26 category = parts[0]; | 26 category = parts[0]; |
27 subtype = parts[1]; | 27 subtype = parts[1]; |
28 } | 28 } |
29 | 29 |
30 return new Image( | 30 return new Image( |
31 style: style, | 31 styles: styles, |
32 width: size, | 32 width: size, |
33 height: size, | 33 height: size, |
34 src: '${kAssetBase}/${category}/2x_web/ic_${subtype}_${size}dp.png' | 34 src: '${kAssetBase}/${category}/2x_web/ic_${subtype}_${size}dp.png' |
35 ); | 35 ); |
36 } | 36 } |
37 } | 37 } |
OLD | NEW |