When isRadio is true it starts with first button selected
roberto77mi opened this issue · comments
When I user isRadio=true I expect the options to be rendered with all button unselected. That would match how radio buttons work in HTML for example.
Right now, the first option is selected. In the example below, button A is selected automatically.
GroupButton(
isRadio: true,
spacing: 10,
onSelected: (index, isSelected) => setState(
() => choiceSelectionOutput = widget.optionsOutputText[index]),
buttons: ["A","B", "C"]
)
Hello @roberto77mi 👋🏻
Thank you for this issue !
I create this functionality in this pr
Now your example will work according to the principle that you described.
Hi @Frezyx ,
I'm using the latest version of the plugin, but the functionality OP suggested is still not available for me.
Here is an example :
GroupButton(
isRadio: true,
spacing: 10,
onSelected: (index, isSelected) => print('$index button is selected'),
buttons: ["Male", "Female"],
),
I want both radio buttons (Male and Female) to be in unselected state when it's first rendered, until user selects an option. Am I missing anything here?
Hello @ramith-ascentic 👋🏻
I do not published update with this functionality.
I will write you about it.
Now i publish this changes to pub.dev.
Update package version to 2.1.0 and see changes.
Have a good day !
Awesome! Thanks for the update, works great!
And it comes because https://github.com/Frezyx/group_button/blob/master/lib/src/group_button_body.dart#L60 selected index is always 0.