ComCheckbox constructor

const ComCheckbox({
  1. Key? key,
  2. required bool? value,
  3. bool tristate = false,
  4. required ValueChanged<bool?>? onChanged,
  5. MouseCursor? mouseCursor,
  6. Color? activeColor,
  7. WidgetStateProperty<Color?>? fillColor,
  8. Color? checkColor,
  9. Color? focusColor,
  10. Color? hoverColor,
  11. WidgetStateProperty<Color?>? overlayColor,
  12. double? splashRadius,
  13. MaterialTapTargetSize? materialTapTargetSize,
  14. VisualDensity? visualDensity = const VisualDensity(horizontal: -4.0, vertical: -4.0),
  15. FocusNode? focusNode,
  16. bool autofocus = false,
  17. OutlinedBorder? shape,
  18. BorderSide? side,
  19. bool isError = false,
  20. Offset offset = const Offset(0.5, 0.5),
  21. String? semanticLabel,
})

Creates a Material Design checkbox.

The checkbox itself does not maintain any state. Instead, when the state of the checkbox changes, the widget calls the onChanged callback. Most widgets that use a checkbox will listen for the onChanged callback and rebuild the checkbox with a new value to update the visual appearance of the checkbox.

The following arguments are required:

  • value, which determines whether the checkbox is checked. The value can only be null if tristate is true.
  • onChanged, which is called when the value of the checkbox should change. It can be set to null to disable the checkbox.

Implementation

const ComCheckbox({
  super.key,
  required this.value,
  this.tristate = false,
  required this.onChanged,
  this.mouseCursor,
  this.activeColor,
  this.fillColor,
  this.checkColor,
  this.focusColor,
  this.hoverColor,
  this.overlayColor,
  this.splashRadius,
  this.materialTapTargetSize,
  this.visualDensity = const VisualDensity(horizontal: -4.0, vertical: -4.0),
  this.focusNode,
  this.autofocus = false,
  this.shape,
  this.side,
  this.isError = false,
  this.offset = const Offset(0.5, 0.5),
  this.semanticLabel,
})  : _checkboxType = _CheckboxType.material,
      assert(tristate || value != null);