1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
| int groupValue = 1; _onChange(value){ if(mounted) setState(() { groupValue = value; }); }
Row( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Radio( value: 1, groupValue: groupValue, onChanged: (T) => _onChange(T), ), Radio( value: 2, groupValue: groupValue, onChanged: (T) => _onChange(T), ), Radio( value: 3, groupValue: groupValue, onChanged: (T) => _onChange(T), ), ], )
|