Radio
C2CRadio is a customizable radio button widget for Flutter applications. It allows for various customizations including colors, borders, text, and error handling. This widget can be used in forms and settings where a user needs to select a single option from a group.
Installation
cpub add c2c_radio
or
flutter pub add c2c_radio --hosted-url=https://pub.csp.scrum-dev.com
Example
C2CRadio(
label: 'Option 1',
checked: true,
onChanged: (bool value) {
// Handle radio button change
},
// Additional customizations
);
Properties
| Property | Description | Type |
|---|---|---|
label | The text displayed next to the radio button. | dynamic |
labelTextStyle | Style applied to the label text. | TextStyle? |
checked | Whether the radio button is selected or not. | bool |
disabled | Whether the radio button is disabled or not. | bool |
onChanged | Callback function when the radio button is toggled. | Function(bool)? |
error | Error message displayed below the radio button. | dynamic |
errorTextStyle | Style applied to the error message text. | TextStyle? |
description | Description text displayed below the label. | dynamic |
descriptionTextStyle | Style applied to the description text. | TextStyle? |
errorTextSpacing | Spacing between the error message and the radio button. | double? |
labelSpacingLeft | Left spacing applied to the label text. | double? |
backgroundColor | Background color of the radio button. | Color? |
borderSide | Border style applied to the radio button. | BorderSide? |
checkColor | Color of the check mark inside the radio button. | Color? |
activeBackgroundColor | Background color when the radio button is selected. | Color? |
activeBorderSide | Border style when the radio button is selected. | BorderSide? |
disabledCheckColor | Check mark color when the radio button is disabled. | Color? |
disabledBackgroundColor | Background color when the radio button is disabled. | Color? |
disabledBorderSide | Border style when the radio button is disabled. | BorderSide? |
errorCheckColor | Check mark color when there is an error. | Color? |
errorBackgroundColor | Background color when there is an error. | Color? |
errorBorderSide | Border style when there is an error. | BorderSide? |
radioSize | Size of the radio button. | double? |
errorShadow | Shadow applied to the radio button when there is an error. | BoxShadow? |
showErrorMessage | Determines whether the error message is displayed. | bool |