CheckboxListTile constructor Null safety
- {Key? key,
- required bool? value,
- required ValueChanged<
bool?> ? onChanged, - Color? activeColor,
- Color? checkColor,
- bool? enabled,
- Color? tileColor,
- Widget? title,
- Widget? subtitle,
- bool isThreeLine = false,
- bool? dense,
- Widget? secondary,
- bool selected = false,
- ListTileControlAffinity controlAffinity = ListTileControlAffinity.platform,
- bool autofocus = false,
- EdgeInsetsGeometry? contentPadding,
- bool tristate = false,
- ShapeBorder? shape,
- OutlinedBorder? checkboxShape,
- Color? selectedTileColor,
- BorderSide? side,
- VisualDensity? visualDensity,
- FocusNode? focusNode,
- bool? enableFeedback}
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 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.
The value of tristate must not be null.
Implementation
const CheckboxListTile({
super.key,
required this.value,
required this.onChanged,
this.activeColor,
this.checkColor,
this.enabled,
this.tileColor,
this.title,
this.subtitle,
this.isThreeLine = false,
this.dense,
this.secondary,
this.selected = false,
this.controlAffinity = ListTileControlAffinity.platform,
this.autofocus = false,
this.contentPadding,
this.tristate = false,
this.shape,
this.checkboxShape,
this.selectedTileColor,
this.side,
this.visualDensity,
this.focusNode,
this.enableFeedback,
}) : assert(tristate != null),
assert(tristate || value != null),
assert(isThreeLine != null),
assert(!isThreeLine || subtitle != null),
assert(selected != null),
assert(controlAffinity != null),
assert(autofocus != null);