@@ -198,15 +198,6 @@ class GroupedRadio<T> extends StatefulWidget {
198
198
}
199
199
200
200
class _GroupedRadioState <T > extends State <GroupedRadio <T >> {
201
- T selectedValue;
202
-
203
- @override
204
- void initState () {
205
- super .initState ();
206
-
207
- selectedValue = widget.value;
208
- }
209
-
210
201
@override
211
202
Widget build (BuildContext context) {
212
203
final widgetList = < Widget > [];
@@ -254,7 +245,7 @@ class _GroupedRadioState<T> extends State<GroupedRadio<T>> {
254
245
final optionValue = option.value;
255
246
final isOptionDisabled = true == widget.disabled? .contains (optionValue);
256
247
final control = Radio <T >(
257
- groupValue: selectedValue ,
248
+ groupValue: widget.value ,
258
249
activeColor: widget.activeColor,
259
250
focusColor: widget.focusColor,
260
251
hoverColor: widget.hoverColor,
@@ -263,10 +254,7 @@ class _GroupedRadioState<T> extends State<GroupedRadio<T>> {
263
254
onChanged: isOptionDisabled
264
255
? null
265
256
: (T selected) {
266
- setState (() {
267
- selectedValue = selected;
268
- });
269
- widget.onChanged (selectedValue);
257
+ widget.onChanged (selected);
270
258
},
271
259
);
272
260
@@ -275,10 +263,7 @@ class _GroupedRadioState<T> extends State<GroupedRadio<T>> {
275
263
onTap: isOptionDisabled
276
264
? null
277
265
: () {
278
- setState (() {
279
- selectedValue = optionValue;
280
- });
281
- widget.onChanged (selectedValue);
266
+ widget.onChanged (optionValue);
282
267
},
283
268
);
284
269
0 commit comments