CheckboxListTile constructor
- Key? key,
- required bool? value,
- required ValueChanged<
bool?> ? onChanged, - MouseCursor? mouseCursor,
- Color? activeColor,
- MaterialStateProperty<
Color?> ? fillColor, - Color? checkColor,
- Color? hoverColor,
- MaterialStateProperty<
Color?> ? overlayColor, - double? splashRadius,
- MaterialTapTargetSize? materialTapTargetSize,
- VisualDensity? visualDensity,
- FocusNode? focusNode,
- bool autofocus = false,
- ShapeBorder? shape,
- BorderSide? side,
- bool isError = false,
- bool? enabled,
- Color? tileColor,
- Widget? title,
- Widget? subtitle,
- bool isThreeLine = false,
- bool? dense,
- Widget? secondary,
- bool selected = false,
- ListTileControlAffinity? controlAffinity,
- EdgeInsetsGeometry? contentPadding,
- bool tristate = false,
- OutlinedBorder? checkboxShape,
- Color? selectedTileColor,
- ValueChanged<
bool> ? onFocusChange, - bool? enableFeedback,
- String? checkboxSemanticLabel,
- double checkboxScaleFactor = 1.0,
- bool internalAddSemanticForOnTap = false,
Creates a combination of a list tile and a checkbox.
The checkbox tile 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 tile 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. Thevalue
can only be null iftristate
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 CheckboxListTile({
super.key,
required this.value,
required this.onChanged,
this.mouseCursor,
this.activeColor,
this.fillColor,
this.checkColor,
this.hoverColor,
this.overlayColor,
this.splashRadius,
this.materialTapTargetSize,
this.visualDensity,
this.focusNode,
this.autofocus = false,
this.shape,
this.side,
this.isError = false,
this.enabled,
this.tileColor,
this.title,
this.subtitle,
this.isThreeLine = false,
this.dense,
this.secondary,
this.selected = false,
this.controlAffinity,
this.contentPadding,
this.tristate = false,
this.checkboxShape,
this.selectedTileColor,
this.onFocusChange,
this.enableFeedback,
this.checkboxSemanticLabel,
this.checkboxScaleFactor = 1.0,
this.internalAddSemanticForOnTap = false,
}) : _checkboxType = _CheckboxType.material,
assert(tristate || value != null),
assert(!isThreeLine || subtitle != null);