flutter/examples/fn/widgets/item.dart
Rafael Weinstein 202f99d71d Initial commit of Effen reactive framework experiment for Sky
This is just a proof of concept. If we like this direction, it will move out of the examples directory (likely re-written) and be committed in smaller pieces with unit tests and formal reviews.

TBR=abarth
BUG=

Review URL: https://codereview.chromium.org/971183002
2015-03-02 20:55:02 -08:00

42 lines
707 B
Dart

library item;
import 'dart:sky' as sky;
import 'fn.dart';
import 'widgets.dart';
enum Color { RED, GREEN }
class Item extends Component {
String label;
Color _color = Color.GREEN;
Item({ Object key, this.label }) : super(key: key);
Node render() {
return new Container(
children: [
new Radio(
onChanged: changed,
value: Color.GREEN,
groupValue: _color
),
new Radio(
onChanged: changed,
value: Color.RED,
groupValue: _color
),
new Text("$label: ${Color.values[_color.index]}")
]
);
}
void changed(Object value) {
setState(() {
_color = value;
});
}
}