form method
Implementation
Form form([GlobalKey<FormState>? key, XData? instance]) {
key = key ?? GlobalKey<FormState>();
return Form(
key: key,
child: Column(
children: fields
.where((element) => element.fieldtype != Dtype.autoIncrement)
.toList()
.map<Widget>((e) {
if (instance != null) {
_formValue.addAll({
e.field: instance.data.containsKey(e.field)
? instance.data[e.field]
: null
});
if (e.dataType == DatatypeEnum.model) {
return _dropdownButton(e, instance);
}
return _textFormFiled(e, instance);
}
return e.dataType == DatatypeEnum.model
? _dropdownButton(e)
: _textFormFiled(e);
}).toList()),
);
}