fieldToInput static method
Widget
fieldToInput({
- required Field field,
- required bool creationMode,
- int? deepLevel,
- ValueChanged<
List< ? onChangeChildStructure,DynamicFieldItem> > - ValueChanged<
List< ? onChildChange,StructuredFieldItem> > - List<
DynamicFieldItem> ? initialChildrenData,
Implementation
static Widget fieldToInput({
required Field field,
required bool creationMode,
int? deepLevel,
/// ? Dynamic Field recursive callback
ValueChanged<List<DynamicFieldItem>>? onChangeChildStructure,
/// ? Structured field recursive callback
ValueChanged<List<StructuredFieldItem>>? onChildChange,
/// ? Dynamic field recursive initial data
List<DynamicFieldItem>? initialChildrenData,
}) {
if (field is BinaryField) {
// TODO(alphamikle): If the binary field will be used - it's need to be implemented
return const SizedBox.shrink();
} else if (field is BoolField) {
return BoolFieldCell(field: field, creationMode: creationMode);
} else if (field is ColorField) {
return ColorFieldCell(field: field, creationMode: creationMode);
} else if (field is DateTimeField) {
return DateFieldCell(field: field, creationMode: creationMode);
} else if (field is EnumField) {
return EnumFieldCell(field: field, creationMode: creationMode);
} else if (field is FontField) {
return FontFieldCell(field: field, creationMode: creationMode);
} else if (field is HeaderField) {
return HeaderFieldCell(field: field);
} else if (field is IconField) {
return IconFieldCell(field: field, creationMode: creationMode);
} else if (field is IdField) {
return IdFieldCell(field: field, creationMode: creationMode);
} else if (field is ModelsSelectorField) {
return ModelsSelectorFieldCell(field: field, creationMode: creationMode);
} else if (field is StringField) {
return StringFieldCell(field: field, creationMode: creationMode);
} else if (field is MultiSelectorField) {
return MultiSelectorFieldCell(field: field, creationMode: creationMode);
} else if (field is NumberField) {
return NumberFieldCell(field: field, creationMode: creationMode);
} else if (field is QueryFilterField) {
return QueryFilterCell(
field: field,
creationMode: creationMode,
onChildChange: onChildChange,
deepLevel: deepLevel ?? 0,
);
} else if (field is QueryFilterValueField) {
return QueryFilterValueFieldCell(field: field, creationMode: creationMode);
} else if (field is ScreenField) {
return ScreenFieldCell(field: field, creationMode: creationMode);
} else if (field is SelectorField) {
return SelectorFieldCell(field: field, creationMode: creationMode);
} else if (field is StructureField) {
return StructureFieldCell(field: field, creationMode: creationMode);
} else if (field is StructuredField) {
return StructuredFieldCell(
field: field,
creationMode: creationMode,
onChildChange: onChildChange,
deepLevel: deepLevel ?? 0,
);
} else if (field is DynamicField) {
return DynamicFieldCell(
field: field,
creationMode: creationMode,
deepLevel: deepLevel ?? 0,
onChangeChildStructure: onChangeChildStructure,
initialChildrenData: initialChildrenData ?? [],
);
}
// TODO(alphamikle): [FIELDS] Add new fields here
final String warning = '$field mapper is not implemented!';
logInfo('$warning\n${StackTrace.current}');
return ErrorFieldCell(warning: warning);
}