Open dufontes opened 4 years ago
Hi, for example like this:
body: Center(
child: SingleChildScrollView(
child: isLoading
? CircularProgressIndicator()
: ParsedFormProvider(
create: (_) => JsonFormManager(),
content: fileContent,
parsers: components.getDefaultParserList(),
child: Column(
children: [
FormRenderer<JsonFormManager>(
renderers: components.getReactiveRenderers(),
),
// Using Builder to obtain a BuildContext already containg JsonFormManager
Builder(
builder: (context) {
return RaisedButton(
child: Text('Submit'),
onPressed: () {
var formProperties =
FormProvider.of<JsonFormManager>(context)
.getFormProperties();
// send data to server:
for (var property in formProperties) {
// Print to console for demonstration purposes
print(
'${property.id} ${property.property} ${property.value}');
}
},
);
},
),
],
),
),
),
),
I just also implemented a working example here: https://github.com/OndrejKunc/flutter_dynamic_forms/blob/master/packages/flutter_dynamic_forms_components/example/lib/simple_submit_form/simple_submit_form.dart