FlutterToggleButton constructor

FlutterToggleButton({
  1. Key? key,
  2. required List items,
  3. double outerContainerMargin = 7.87,
  4. double buttonWidth = 139,
  5. double buttonHeight = 68,
  6. double borderRadius = 108,
  7. double buttonTextFontSize = 22,
  8. FontWeight enableTextFontWeight = FontWeight.w600,
  9. FontWeight disableTextFontWeight = FontWeight.w500,
  10. Color enableTextColor = Colors.white,
  11. Color disableTextColor = const Color(0xff7A7A7A),
  12. Color? outerContainerColor,
  13. Color? buttonColor,
  14. LinearGradient? outerContainerGradient,
  15. LinearGradient? buttonGradient,
  16. Color outerContainerBorderColor = Colors.transparent,
  17. double outerContainerBorderWidth = 0,
  18. Color buttonBorderColor = Colors.transparent,
  19. double buttonBorderWidth = 0,
  20. void onTap(
    1. int
    )?,
})

Creates a FlutterToggleButton widget.

The items parameter is required and must contain a list of String, int, double, or Widget. Other parameters are optional and allow for customization of the widget's appearance and behavior.

Implementation

FlutterToggleButton({
  super.key,
  required this.items,
  this.outerContainerMargin = 7.87,
  this.buttonWidth = 139,
  this.buttonHeight = 68,
  this.borderRadius = 108,
  this.buttonTextFontSize = 22,
  this.enableTextFontWeight = FontWeight.w600,
  this.disableTextFontWeight = FontWeight.w500,
  this.enableTextColor = Colors.white,
  this.disableTextColor = const Color(0xff7A7A7A),
  this.outerContainerColor,
  this.buttonColor,
  this.outerContainerGradient,
  this.buttonGradient,
  this.outerContainerBorderColor = Colors.transparent,
  this.outerContainerBorderWidth = 0,
  this.buttonBorderColor = Colors.transparent,
  this.buttonBorderWidth = 0,
  this.onTap,
})  : assert(
          items.every((item) =>
              item is String ||
              item is double ||
              item is int ||
              item is Widget),
          'items list must contain either String, int, double or a Widget'),
      assert((outerContainerColor == null || outerContainerGradient == null),
          'Provide either outerContainerColor or outerContainerGradient, not both.'),
      assert((buttonColor == null || buttonGradient == null),
          'Provide either buttonColor or buttonGradient, not both.');