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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

FormBuilderRadio vs FormBuilderRadioGroup #389

Closed
awhitford opened this issue Jul 30, 2020 · 20 comments
Closed

FormBuilderRadio vs FormBuilderRadioGroup #389

awhitford opened this issue Jul 30, 2020 · 20 comments
Labels
question Further information is requested

Comments

@awhitford
Copy link
Collaborator

From the README:

FormBuilderRadio - Used to select one value from a list of Radio Widgets
FormBuilderRadioGroup - Used to select one value from a list of Radio Widgets

馃槙 What's the difference?

@awhitford
Copy link
Collaborator Author

FormBuilderRadio lists the options vertically (column), vs FormBuilderRadioGroup lists the option horizontally (row).

@danvick danvick added the question Further information is requested label Aug 2, 2020
@danvick
Copy link
Collaborator

danvick commented Aug 2, 2020

FormBuilderRadio was the initial control that uses a ListView underneath therefore the options are shown vertically. Due to the need for more layout options, we included FormBuilderRadioGroup which was initially based on the package group_radio_button which also had a different API than the initial Radio field.

The package, however, proved insufficient for our purpose and we retired it and built our own implementation.

Note that FormBuilderRadioGroup allows for both orientations using the orientation attribute.

I agree we need to make the distinction clear in README.

I think we should also deprecate FormBuilderRadio.

@danvick
Copy link
Collaborator

danvick commented Aug 2, 2020

Same applies to FormBuilderCheckboxList and FormBuilderCheckboxGroup

@awhitford
Copy link
Collaborator Author

I support deprecating to avoid confusion.

Unfortunately, I'm running into a problem when my FormBuilderFieldOption child is a ListTile.

BoxConstraints forces an infinite width.

One day, I will figure this out... 馃槙

@awhitford
Copy link
Collaborator Author

I resorted to StackOverflow for some advice, but I'm still not happy... 馃槱

When I replaced my FormBuilderRadio with FormBuilderRadioGroup (and specified the orientation: GroupedRadioOrientation.vertical), my render blows up because (in this case) my FormBuilderFieldOption child is a ListTile. Normally, I simply wrap the offending infinite width widget in an Expanded, but that is not working here.

I can solve the layout problem if the GestureDetector was wrapped in Expanded.

Should we add a flag to optionally wrap the GestureDetector in an Expanded? 馃

@awhitford
Copy link
Collaborator Author

BTW... I have to admit that I prefer the look of the deprecated FormBuilderRadio instead of the FormBuilderRadioGroup:

Old FormBuilderRadio:
image

New FormBuilderRadioGroup:
image

@slavap
Copy link

slavap commented Aug 4, 2020

@awhitford It is possible to get the same layout with FormBuilderRadioGroup as it was for FormBuilderRadio, but currently I have to specify exact Container width manually, which is absolutely awful.
@danvick Please fix vertical mode, or remove deprecation from FormBuilderRadio.

image

final radio = FormBuilderRadioGroup(
      orientation: GroupedRadioOrientation.vertical,
      controlAffinity: ControlAffinity.trailing,

FormBuilderFieldOption(
      value: v,
      child: Container(width: 400, 

@awhitford
Copy link
Collaborator Author

Yes, I know that I can adjust the control affinity. However, I am now further convinced that FormBuilderCheckboxGroup is buggy:
image

Why isn't this wrapping? (FormBuilderFieldOption.child is a Text.) 馃

@slavap
Copy link

slavap commented Aug 5, 2020

@awhitford It is the same story - you have to specify container width, then it will be possible to get wrapping with Flexible and Text.

@awhitford
Copy link
Collaborator Author

I see that the old deprecated versions use ListTile, and I think it was changed so that the horizontal and wrap layouts could be implemented. Unfortunately, it has a side effect of not being a drop in replacement. I think I finally have an idea on how to fix this...

@FickleLife
Copy link

Just wondering if there's a solution to the overflow wrapping?

@oodavid
Copy link

oodavid commented Nov 14, 2020

Bumping into this too, decided to use the deprecated FormBuilderCheckboxList

@pawangjain
Copy link

@awhitford how did you fix this?
It will be helpful if you can share it.

@awhitford
Copy link
Collaborator Author

@pawangjain Sadly, I don't think I tackled this yet. For my original issue, I ended up using the deprecated control. However, a version 4 migration is in the future, so...

@danvick
Copy link
Collaborator

danvick commented Nov 24, 2020

I think I solved this issue in v4 but forgot to port it to v3. I'll do that as soon as I can and release an update.

@mgav
Copy link

mgav commented Dec 21, 2020

Using orientation: OptionsOrientation.vertical, with flutter_form_builder: ^4.0.2 I was able or orient each radio option vertically.

Here's the whole block of code:

FormBuilderRadioGroup( name: 'formerly_an_attribute', decoration: const InputDecoration( border: InputBorder.none, labelStyle: TextStyle(fontStyle: FontStyle.italic), ), wrapVerticalDirection: VerticalDirection.down, // doesn't work in 4.0 (use below) orientation: GroupedRadioOrientation.vertical, orientation: OptionsOrientation.vertical,

And here's a screenshot:

image

@ayaanpathan
Copy link

@awhitford It is possible to get the same layout with FormBuilderRadioGroup as it was for FormBuilderRadio, but currently I have to specify exact Container width manually, which is absolutely awful.
@danvick Please fix vertical mode, or remove deprecation from FormBuilderRadio.

image

final radio = FormBuilderRadioGroup(
      orientation: GroupedRadioOrientation.vertical,
      controlAffinity: ControlAffinity.trailing,

FormBuilderFieldOption(
      value: v,
      child: Container(width: 400, 

Hi, How do i customize the shape and size of the radio button

@faisalmushtaq007
Copy link

how can i get rid of the space thats between the vertical radios?

@Natan-hub
Copy link

Currently in this FormBuilderRadioGroup I can select the options by clicking exactly on the Radio button. Isn't there a way to select the options by clicking on the options label as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests