mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00

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
42 lines
707 B
Dart
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;
|
|
});
|
|
}
|
|
}
|