CustomRadioButton<T> constructor

CustomRadioButton<T>({
  1. Key? key,
  2. required List<String> buttonLables,
  3. required List<T> buttonValues,
  4. ButtonTextStyle buttonTextStyle = const ButtonTextStyle(),
  5. bool autoWidth = false,
  6. required void radioButtonValue(
    1. T
    ),
  7. required Color unSelectedColor,
  8. Color? unSelectedBorderColor,
  9. double padding = 3,
  10. double spacing = 0.0,
  11. required Color selectedColor,
  12. Color? selectedBorderColor,
  13. double height = 35,
  14. double width = 100,
  15. bool enableButtonWrap = false,
  16. bool horizontal = false,
  17. bool enableShape = false,
  18. double elevation = 10,
  19. double shapeRadius = 50,
  20. double radius = 20,
  21. T? defaultSelected,
  22. ShapeBorder? customShape,
  23. ScrollController? scrollController,
  24. bool absoluteZeroSpacing = false,
  25. EdgeInsetsGeometry? margin,
  26. WrapAlignment wrapAlignment = WrapAlignment.start,
  27. List<T> disabledValues = const [],
  28. Color? disabledColor,
})

spacing Spacing between buttons

Implementation

CustomRadioButton({
  super.key,
  required this.buttonLables,
  required this.buttonValues,
  this.buttonTextStyle = const ButtonTextStyle(),
  this.autoWidth = false,
  required this.radioButtonValue,
  required this.unSelectedColor,
  this.unSelectedBorderColor,
  double padding = 3,
  double spacing = 0.0,
  required this.selectedColor,
  this.selectedBorderColor,
  this.height = 35,
  this.width = 100,
  this.enableButtonWrap = false,
  this.horizontal = false,
  this.enableShape = false,
  this.elevation = 10,
  this.shapeRadius = 50,
  this.radius = 20,
  this.defaultSelected,
  this.customShape,
  this.scrollController,
  this.absoluteZeroSpacing = false,
  this.margin,
  this.wrapAlignment = WrapAlignment.start,
  this.disabledValues = const [],
  this.disabledColor,
})  : assert(buttonLables.length == buttonValues.length,
          "Button values list and button lables list should have same number of eliments "),
      // assert(
      //     buttonValues.toSet().intersection(disabledValues.toSet()) ==
      //         disabledValues.toSet(),
      //     "Disabled values should be present in button values"),
      assert(buttonValues.toSet().length == buttonValues.length,
          "Multiple buttons with same value cannot exist") {
  if (absoluteZeroSpacing) {
    this.padding = 0;
    this.spacing = 0;
  } else {
    this.padding = padding;
    this.spacing = spacing;
  }
}