FlutterToggleButton constructor
FlutterToggleButton({
- Key? key,
- required List items,
- double outerContainerMargin = 7.87,
- double buttonWidth = 139,
- double buttonHeight = 68,
- double borderRadius = 108,
- double buttonTextFontSize = 22,
- FontWeight enableTextFontWeight = FontWeight.w600,
- FontWeight disableTextFontWeight = FontWeight.w500,
- Color enableTextColor = Colors.white,
- Color disableTextColor = const Color(0xff7A7A7A),
- Color? outerContainerColor,
- Color? buttonColor,
- LinearGradient? outerContainerGradient,
- LinearGradient? buttonGradient,
- Color outerContainerBorderColor = Colors.transparent,
- double outerContainerBorderWidth = 0,
- Color buttonBorderColor = Colors.transparent,
- double buttonBorderWidth = 0,
- void onTap()?,
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.');