ComCheckbox.adaptive constructor

const ComCheckbox.adaptive({
  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 an adaptive Checkbox based on whether the target platform is iOS or macOS, following Material design's Cross-platform guidelines.

On iOS and macOS, this constructor creates a CupertinoCheckbox, which has matching functionality and presentation as Material checkboxes, and are the graphics expected on iOS. On other platforms, this creates a Material design Checkbox.

If a CupertinoCheckbox is created, the following parameters are ignored: mouseCursor, fillColor, hoverColor, overlayColor, splashRadius, materialTapTargetSize, visualDensity, isError. However, shape and side will still affect the CupertinoCheckbox and should be handled if native fidelity is important.

The target platform is based on the current Theme: ThemeData.platform.

Implementation

const ComCheckbox.adaptive({
  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.adaptive,
      assert(tristate || value != null);