RadioGroupWidget<T> constructor
const
RadioGroupWidget<T> ({
- Key? key,
- required List<
T> items, - ValueChanged<
T> ? onChanged, - String? title,
- String? subtitle,
- TextStyle? titleStyle,
- TextStyle? subtitleStyle,
- Color? selectedTitleColor,
- Color? unselectedTitleColor,
- Color? selectedSubtitleColor,
- Color? unselectedSubtitleColor,
- IconData selectedRadioIcon = Icons.radio_button_checked,
- IconData unselectedRadioIcon = Icons.radio_button_unchecked,
- Color? selectedRadioIconColor,
- Color? unselectedRadioIconColor,
- double radioIconSize = 24,
- IconData? selectedTrailingIcon = Icons.arrow_forward_ios,
- IconData? unselectedTrailingIcon = Icons.arrow_forward_ios,
- Color? selectedTrailingColor = Colors.white,
- Color? unselectedTrailingColor,
- double trailingIconSize = 18,
- Color? unSelectedBackgroundColo = Colors.white,
- Color? selectedunSelectedBackgroundColo = Colors.blue,
- double borderRadius = 12,
- double borderWidth = 1,
- Color? borderColor = Colors.transparent,
- Color? shadowColor,
- int initialIndex = 0,
- double dividerHeight = 12,
Example Usage
RadioGroupWidget<String>(
items: ['Basic', 'Pro', 'Enterprise'],
initialIndex: 0, // default selected item ("Basic")
titleBuilder: (v) => v,
subtitleBuilder: (v) => 'Plan: $v',
onChanged: (item) {
print("Selected: $item");
},
),
Implementation
const RadioGroupWidget({
super.key,
required this.items,
this.onChanged,
// Text
this.title,
this.subtitle,
this.titleStyle,
this.subtitleStyle,
// Selected / Unselected text colors
this.selectedTitleColor,
this.unselectedTitleColor,
this.selectedSubtitleColor,
this.unselectedSubtitleColor,
// LEFT Radio Icons
this.selectedRadioIcon = Icons.radio_button_checked,
this.unselectedRadioIcon = Icons.radio_button_unchecked,
this.selectedRadioIconColor,
this.unselectedRadioIconColor,
this.radioIconSize = 24,
// RIGHT Trailing Icons
this.selectedTrailingIcon = Icons.arrow_forward_ios,
this.unselectedTrailingIcon = Icons.arrow_forward_ios,
this.selectedTrailingColor = Colors.white,
this.unselectedTrailingColor,
this.trailingIconSize = 18,
// UI
this.unSelectedBackgroundColo = Colors.white,
this.selectedunSelectedBackgroundColo = Colors.blue,
this.borderRadius = 12,
this.borderWidth = 1,
this.borderColor = Colors.transparent,
this.shadowColor,
this.initialIndex = 0, // default to first item
// Divider
this.dividerHeight = 12,
});