Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When isRadio is true it starts with first button selected #12

Closed
roberto77mi opened this issue Mar 28, 2021 · 10 comments · Fixed by #16 or #17
Closed

When isRadio is true it starts with first button selected #12

roberto77mi opened this issue Mar 28, 2021 · 10 comments · Fixed by #16 or #17

Comments

@roberto77mi
Copy link

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"]
        )
@Frezyx Frezyx pinned this issue Apr 5, 2021
@Frezyx
Copy link
Owner

Frezyx commented Apr 5, 2021

Hello @roberto77mi 👋🏻

Thank you for this issue !
I create this functionality in this pr

@Frezyx Frezyx linked a pull request Apr 5, 2021 that will close this issue
@Frezyx
Copy link
Owner

Frezyx commented Apr 5, 2021

Now your example will work according to the principle that you described.

@ramith-ascentic
Copy link

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?

@Frezyx
Copy link
Owner

Frezyx commented Apr 7, 2021

Hello @ramith-ascentic 👋🏻
I do not published update with this functionality.
I will write you about it.

@Frezyx Frezyx linked a pull request Apr 7, 2021 that will close this issue
@Frezyx Frezyx closed this as completed in #17 Apr 7, 2021
@Frezyx
Copy link
Owner

Frezyx commented Apr 7, 2021

Now i publish this changes to pub.dev.
Update package version to 2.1.0 and see changes.

Have a good day !

@ramith-ascentic
Copy link

Awesome! Thanks for the update, works great!

@SalahAdDin
Copy link
Contributor

SalahAdDin commented Jun 7, 2021

@Frezyx I don't know why, but i still have this bug:
image
image

@SalahAdDin
Copy link
Contributor

@Frezyx More debbugging here:
image

@SalahAdDin
Copy link
Contributor

And it comes because https://github.com/Frezyx/group_button/blob/master/lib/src/group_button_body.dart#L60 selected index is always 0.

@SalahAdDin
Copy link
Contributor

@Frezyx And it is fixed by #38.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants