fillColor property
The color that fills the checkbox, in all WidgetStates.
Resolves in the following states:
This example resolves the fillColor based on the current WidgetState
of the Checkbox, providing a different Color when it is
WidgetState.disabled.
Checkbox(
value: _value,
// If `onChanged` is null, this checkbox is disabled.
// If `onChanged` is not null, this checkbox is enabled.
onChanged: _nullableOnChanged,
fillColor: WidgetStateProperty.resolveWith<Color>((
Set<WidgetState> states,
) {
if (states.contains(WidgetState.disabled)) {
return Colors.orange.withValues(alpha: .32);
}
return Colors.orange;
}),
)
If specified, overrides the default value of Checkbox.fillColor.
Implementation
final WidgetStateProperty<Color?>? fillColor;