custom_radio_group_list 1.1.1 copy "custom_radio_group_list: ^1.1.1" to clipboard
custom_radio_group_list: ^1.1.1 copied to clipboard

Flutter package to create list of radio button, by providing a list of objects it can be a String list or list of Map..

1.0.0 #

  • Initial release

1.1.0 #

  1. Able to set the color for radio button
  2. You can customize the label as per your needs
  3. Radio List can be generated using list of object.

Usage #

Example 1 #

This example shows using an object list

          RadioGroup(
                  items: sampleList,
                  selectedItem: selectedItemNew,
                  onChanged: (value) {
                    selectedItemNew = value;
                    final snackBar = SnackBar(content: Text("$value"));
                    ScaffoldMessenger.of(context).showSnackBar(snackBar);
                  },
                  labelBuilder: (ctx, index) {
                    return Row(
                      children: [
                        Text(
                          'Id : ${sampleList[index].id}',
                          style: const TextStyle(color: Colors.red),
                        ),
                        const SizedBox(
                          width: 10,
                        ),
                        Text(
                          'City : ${sampleList[index].title}',
                        ),
                      ],
                    );
                  },
                  shrinkWrap: true,
                  disabled: false),

Example 2 #

This example shows use of String list to display radio group list.

          RadioGroup(
                  items: stringList,
                  onChanged: (value) {
                    print('Value : $value');
                    selectedItem = value;
                    final snackBar = SnackBar(content: Text("$value"));
                    ScaffoldMessenger.of(context).showSnackBar(snackBar);
                  },
                  selectedItem: selectedItem,
                  disabled: true,
                  shrinkWrap: true,
                  labelBuilder: (ctx, index) {
                    return Text(stringList[index]);
                  },
                ),

Example 3 #

This example shows setting label and radio button color.

          RadioGroup(
                          items: stringList,
                          onChanged: (value) {
                            print('Value : $value');
                            selectedItem = value;
                            final snackBar = SnackBar(content: Text("$value"));
                            ScaffoldMessenger.of(context).showSnackBar(snackBar);
                          },
                          selectedItem: selectedItem,
                          shrinkWrap: true,
                          fillColor: Colors.green,
                          labelBuilder: (ctx, index) {
                            return Text(
                              stringList[index],
                              style: TextStyle(
                                  color: selectedItem == stringList[index]
                                      ? Colors.green
                                      : Colors.black),
                            );
                          },
                        ),
15
likes
145
points
278
downloads

Publisher

verified publisherintouchsofts.com

Weekly Downloads

Flutter package to create list of radio button, by providing a list of objects it can be a String list or list of Map..

Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter

More

Packages that depend on custom_radio_group_list