build method

  1. @override
Widget build(
  1. BuildContext context
)
override

Builds an adaptive Checkbox with optional tristate support.

Changes are applied to all owners simultaneously unless the property is read-only.

Implementation

@override
Widget build(BuildContext context) {
  return Checkbox.adaptive(
    //visualDensity: VisualDensity.standard,
    value: value,
    tristate: nullable,
    onChanged: (bool? value) {
      if (!readOnlyProperty) {
        if (value != null || nullable) {
          for (var owner in widget.owners) {
            var property =
                owner.getProperty(widget.propertyName)
                    as InspectableProperty<bool>?;
            if (property != null && property.setValue != null) {
              property.setValue!(owner, value!, null);
              this.value = value;
              if (widget.onUpdateProperty != null) {
                widget.onUpdateProperty!(value);
              }
              if (mounted) {
                setState(() {});
              }
            }
          }
        }
      }
    },
  );
}