flutter-jsonschema-form
A simple Flutter component capable of using JSON Schema to declaratively build and customize web forms.
Inspired by react-jsonschema-form
Installation
Add dependency to pubspec.yaml
dependencies:
...
flutter_jsonschema_form:
git:
url: git://github.com/edlose16b/flutter_jsonschema_form.git
ref: main
Run in your terminal
flutter packages get
See the File Picker Installation for file fields.
Usage
import 'package:flutter_jsonschema_form/flutter_jsonschema_form.dart';
final jsonSchema = {
"title": "A registration form",
"description": "A simple form example.",
"type": "object",
"required": [
"firstName",
"lastName"
],
"properties": {
"firstName": {
"type": "string",
"title": "First name",
"default": "Chuck"
},
"lastName": {
"type": "string",
"title": "Last name"
},
"telephone": {
"type": "string",
"title": "Telephone",
"minLength": 10
}
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: JsonForm(
jsonSchema: jsonSchema,
onFormDataSaved: (data) {
inspect(data);
},
),
);
}
Additional information
WIP