Skip to main content

Checkbox

The C2CCheckbox widget allows you to create interactive checkboxes with options for customizing labels, error messages, and appearance. You can control the checkbox's state, whether it's checked, indeterminate, or disabled.

Installation

cpub add c2c_checkbox

or

flutter pub add c2c_checkbox --hosted-url=https://pub.csp.scrum-dev.com

Example Usage

To use the C2CCheckbox widget, you can create an instance of it and provide the necessary parameters:

C2CCheckbox(
label: 'Accept Terms & Conditions',
checked: true,
onChanged: (value) {
// Handle checkbox state change
},
error: 'Please accept the terms & conditions.',
// Add more customization options as needed
)

Properties

Here are the properties available for customizing the C2CCheckbox widget:

PropertyDescriptionType
labelLabel text. It can be a [String] or a [Widget].dynamic
labelTextStyleLabel text style.TextStyle?
checkedWhether the checkbox is checked.bool
indeterminateWhether the checkbox is indeterminate.bool
disabledWhether the checkbox is disabled.bool
onChangedCalled when the checkbox is changed.void Function(bool)?
errorError text. It can be a [String] or a [Widget].dynamic
errorTextStyleError text style.TextStyle?
descriptionDescription text. It can be a [String] or a [Widget].dynamic
descriptionTextStyleDescription text style.TextStyle?
errorTextSpacingSpacing between error text and label.double?
labelSpacingLeftSpacing between label and checkbox.double?
checkColorColor of the check icon.Color?
backgroundColorColor of the background.Color?
borderSideBorder side of the checkbox.BorderSide?
activeBackgroundColorColor of the background when the checkbox is active.Color?
activeBorderSideBorder side of the checkbox when the checkbox is active.BorderSide?
disabledBackgroundColorColor of the background when the checkbox is disabled.Color?
disabledBorderSideBorder side of the checkbox when the checkbox is disabled.BorderSide?
errorBackgroundColorColor of the background when the checkbox has an error.Color?
errorBorderSideBorder side of the checkbox when the checkbox has an error.BorderSide?
inverseWhether the checkbox is inverse.bool?
borderRadiusBorder radius of the checkbox.double?
viewOnlyWhether the checkbox is view only.bool
checkboxSizeSize of the checkbox.double?
errorShadowShadow of the checkbox when the checkbox has an error.BoxShadow?
showErrorMessageWhether to show the error message.bool