CupertinoCheckbox constructor

const CupertinoCheckbox({
  1. Key? key,
  2. required bool? value,
  3. bool tristate = false,
  4. required ValueChanged<bool?>? onChanged,
  5. MouseCursor? mouseCursor,
  6. Color? activeColor,
  7. @Deprecated('Use fillColor instead. ' 'fillColor now manages the background color in all states. ' 'This feature was deprecated after v3.24.0-0.2.pre.') Color? inactiveColor,
  8. WidgetStateProperty<Color?>? fillColor,
  9. Color? checkColor,
  10. Color? focusColor,
  11. FocusNode? focusNode,
  12. bool autofocus = false,
  13. BorderSide? side,
  14. OutlinedBorder? shape,
  15. String? semanticLabel,
})

Creates a macOS-styled 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 CupertinoCheckbox({
  super.key,
  required this.value,
  this.tristate = false,
  required this.onChanged,
  this.mouseCursor,
  this.activeColor,
  @Deprecated(
    'Use fillColor instead. '
    'fillColor now manages the background color in all states. '
    'This feature was deprecated after v3.24.0-0.2.pre.'
  )
  this.inactiveColor,
  this.fillColor,
  this.checkColor,
  this.focusColor,
  this.focusNode,
  this.autofocus = false,
  this.side,
  this.shape,
  this.semanticLabel,
}) : assert(tristate || value != null);