RadioGroupWidget<T> constructor

const RadioGroupWidget<T>({
  1. Key? key,
  2. required List<T> items,
  3. ValueChanged<T>? onChanged,
  4. String? title,
  5. String? subtitle,
  6. TextStyle? titleStyle,
  7. TextStyle? subtitleStyle,
  8. Color? selectedTitleColor,
  9. Color? unselectedTitleColor,
  10. Color? selectedSubtitleColor,
  11. Color? unselectedSubtitleColor,
  12. IconData selectedRadioIcon = Icons.radio_button_checked,
  13. IconData unselectedRadioIcon = Icons.radio_button_unchecked,
  14. Color? selectedRadioIconColor,
  15. Color? unselectedRadioIconColor,
  16. double radioIconSize = 24,
  17. IconData? selectedTrailingIcon = Icons.arrow_forward_ios,
  18. IconData? unselectedTrailingIcon = Icons.arrow_forward_ios,
  19. Color? selectedTrailingColor = Colors.white,
  20. Color? unselectedTrailingColor,
  21. double trailingIconSize = 18,
  22. Color? unSelectedBackgroundColo = Colors.white,
  23. Color? selectedunSelectedBackgroundColo = Colors.blue,
  24. double borderRadius = 12,
  25. double borderWidth = 1,
  26. Color? borderColor = Colors.transparent,
  27. Color? shadowColor,
  28. int initialIndex = 0,
  29. 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,
});