custom_radio_group_list 1.1.2
custom_radio_group_list: ^1.1.2 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 #
- Able to set the color for radio button
- You can customize the label as per your needs
- Radio List can be generated using list of object.
1.1.2 #
- Added support for horizontal list
- Support to disable selection in list
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.
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 disabled horizontal list.
SizedBox(
height: 30,
child: RadioGroup(
items: hLisItem,
disabled: true,
scrollDirection: Axis.horizontal,
onChanged: (value) {
print('Value : $value');
hSelectedItem = value;
final snackBar = SnackBar(content: Text("$value"));
ScaffoldMessenger.of(context).showSnackBar(snackBar);
},
selectedItem: hSelectedItem,
shrinkWrap: true,
labelBuilder: (ctx, index) {
return Text(
hLisItem[index],
);
},
),
),