flutter/examples/fn/widgets/icon.dart
Rafael Weinstein 409b12e5df Change the name of Component.render to Component.build in Effen.
"Render" is misleading. "Build" may not be the best word either, it's closer to what's actually happening.

R=ojan@chromium.org
TBR=abarth
BUG=

Review URL: https://codereview.chromium.org/992033002
2015-03-09 13:30:13 -07:00

35 lines
623 B
Dart

part of widgets;
const String kAssetBase = '/sky/assets/material-design-icons';
class Icon extends Component {
Style style;
int size;
String type;
Icon({
String key,
this.style,
this.size,
this.type: ''
}) : super(key: key);
Node build() {
String category = '';
String subtype = '';
List<String> parts = type.split('/');
if (parts.length == 2) {
category = parts[0];
subtype = parts[1];
}
return new Image(
style: style,
width: size,
height: size,
src: '${kAssetBase}/${category}/2x_web/ic_${subtype}_${size}dp.png'
);
}
}