initState method
Reads the initial value and metadata (clamp, readOnly, nullable) from the owners. Disables slider mode when more than one owner is selected.
Implementation
@override
void initState() {
super.initState();
double? value;
if (widget.owners.isNotEmpty) {
var property = widget.owners[0].getProperty(widget.propertyName);
if (property != null) {
value = property.getValue(widget.owners[0]);
clamp = property.clamp as (double, double)?;
initialValue = value ?? 0.0;
}
for (int a = 1; a < widget.owners.length; a++) {
var obj = widget.owners[a];
var property = obj.getProperty(widget.propertyName);
if (property == null) {
value = null;
} else if (property.getValue(obj) != value) {
value = null;
}
}
}
for (var owner in widget.owners) {
var property = owner.getProperty(widget.propertyName);
if (property != null && property.readOnly) {
readOnlyProperty = true;
}
if (property != null && !property.nullable) {
isNullable = false;
}
}
if (widget.owners.length != 1) {
clamp = null;
}
ted = TextEditingController(
text: value != null ? sprintf('%g', [value]) : '',
);
}