Skip to content

Commit f39e891

Browse files
committed
Fixed issue where radio group not submitting value
1 parent ca8575a commit f39e891

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

lib/src/fields/form_builder_radio_group.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ class FormBuilderRadioGroup<T> extends FormBuilderField<T> {
5656
return InputDecorator(
5757
decoration: decoration.copyWith(
5858
enabled: !state.readOnly,
59-
errorText: decoration?.errorText ?? field.errorText,
59+
errorText: decoration?.errorText ?? state.errorText,
6060
),
6161
child: GroupedRadio(
6262
orientation: orientation,
6363
value: initialValue,
6464
options: options,
6565
onChanged: (val) {
66-
field.didChange(val);
66+
state.requestFocus();
67+
state.didChange(val);
6768
},
6869
activeColor: activeColor,
6970
focusColor: focusColor,

lib/src/widgets/grouped_radio.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class GroupedRadio<T> extends StatefulWidget {
2020
final GroupedRadioOrientation orientation;
2121

2222
/// Called when the value of the checkbox group changes.
23-
final ValueChanged<List<T>> onChanged;
23+
final ValueChanged<T> onChanged;
2424

2525
/// The color to use when this checkbox is checked.
2626
///
@@ -264,6 +264,7 @@ class _GroupedRadioState<T> extends State<GroupedRadio<T>> {
264264
setState(() {
265265
selectedValue = selected;
266266
});
267+
widget.onChanged?.call(selectedValue);
267268
},
268269
);
269270

@@ -276,6 +277,7 @@ class _GroupedRadioState<T> extends State<GroupedRadio<T>> {
276277
setState(() {
277278
selectedValue = widget.options[index].value;
278279
});
280+
widget.onChanged?.call(selectedValue);
279281
},
280282
);
281283

0 commit comments

Comments
 (0)