crea_radio_button 0.6.0 copy "crea_radio_button: ^0.6.0" to clipboard
crea_radio_button: ^0.6.0 copied to clipboard

A simple radio button group with any amount of options. Allows rectangular and round buttons, vertical and horizontal.

CreaRadioButton - an easy radio button group #

A package to create simple radio buttons.

Example #

Change border on slected #

alt text

Change background color on selected #

alt text

Unselect is enabled #

alt text

Features #

Render a radio button group:

  • with any number of buttons
  • vertical or horizontal
  • square or round

Limitations #

Currently only supports String as value and button label. An option for RadioGroup is passed via class RadioOption.

Getting started #

To use this plugin, add crea_radio_button as a dependency in your pubspec.yaml file.

RadioButtonGroup #

String radioButtonInput = "";

 RadioButtonGroup(
                buttonHeight: 35,
                buttonWidth: 60,
                circular: true,
                mainColor: Colors.grey,
                selectedColor: Colors.pink.shade400,
                preSelectedIdx: defaultOptionIndex,
                options: [
                  RadioOption("10.0", "10"),
                  RadioOption("25.0", "25"),
                  RadioOption("50.0", "50"),
                  RadioOption("100.0", "100")
                ],
                callback: (RadioOption val) {
                  setState(() {
                    selectedOption = val;
                  });
                })


Default selection #

By default none of the options is preselected. You can specify index of the option you want to be preselected/ defaultIdx: 0

Add Border for seleted option #

By default there is no Border on a button. `selectedBorderSide can be used to add border for the selected option.

Callback #

Callback function returns the selected RadioOption

String radioButtonInput = "";

RadioButtonGroup(
                      vertical: true,
                      options: [
                        RadioOption("1", "1"),
                        RadioOption("2", "2"),
                        RadioOption("3", "3")
                      ],
                      buttonHeight: 50,
                      buttonWidth: 50,
                      defaultIdx: defaultRadioIdx,
                      callback: (val) {
                        setState(() {
                          radioButtonInput = val.text;
                        });
                      });


Additional information #

Contribute here: https://github.com/dutkaD/crea_radio

9
likes
120
pub points
62%
popularity

Publisher

unverified uploader

A simple radio button group with any amount of options. Allows rectangular and round buttons, vertical and horizontal.

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (LICENSE)

Dependencies

flutter

More

Packages that depend on crea_radio_button