from static method
Implementation
static Control? from({
required Map<String, dynamic> schema,
required String scope,
required jfc.ValueChanged onValueChanged,
Map<String, dynamic>? options,
bool isRequired = false,
dynamic defaultValue,
Key? key,
}) {
switch (schema["type"]) {
case ControlTypes.string:
return JFCString(
schema: schema,
scope: scope,
onValueChanged: onValueChanged,
isRequired: isRequired,
defaultValue: defaultValue,
enumeration:
schema["enum"] != null ? List<String>.from(schema["enum"]) : null,
options: options,
key: key,
);
case ControlTypes.integer:
return JFCNumber(
schema: schema,
scope: scope,
onValueChanged: onValueChanged,
isRequired: isRequired,
defaultValue: defaultValue,
options: options,
key: key,
);
case ControlTypes.number:
return JFCNumber(
schema: schema,
scope: scope,
onValueChanged: onValueChanged,
isRequired: isRequired,
defaultValue: defaultValue,
options: options,
precision: 2,
key: key,
);
case ControlTypes.boolean:
return JFCBoolean(
schema: schema,
scope: scope,
onValueChanged: onValueChanged,
isRequired: isRequired,
defaultValue: defaultValue,
options: options,
key: key,
);
default:
return null;
}
}