| OLD | NEW |
| (Empty) |
| 1 library item; | |
| 2 | |
| 3 import '../../../framework/fn.dart'; | |
| 4 import 'dart:sky' as sky; | |
| 5 import 'widgets.dart'; | |
| 6 | |
| 7 enum Color { RED, GREEN } | |
| 8 | |
| 9 class Item extends Component { | |
| 10 | |
| 11 String label; | |
| 12 | |
| 13 Color _color = Color.GREEN; | |
| 14 | |
| 15 Item({ Object key, this.label }) : super(key: key); | |
| 16 | |
| 17 Node render() { | |
| 18 return new Container( | |
| 19 children: [ | |
| 20 new Radio( | |
| 21 onChanged: changed, | |
| 22 value: Color.GREEN, | |
| 23 groupValue: _color | |
| 24 ), | |
| 25 new Radio( | |
| 26 onChanged: changed, | |
| 27 value: Color.RED, | |
| 28 groupValue: _color | |
| 29 ), | |
| 30 | |
| 31 new Text("$label: ${Color.values[_color.index]}") | |
| 32 ] | |
| 33 ); | |
| 34 } | |
| 35 | |
| 36 void changed(Object value) { | |
| 37 setState(() { | |
| 38 _color = value; | |
| 39 }); | |
| 40 } | |
| 41 } | |
| OLD | NEW |