dynamic_json_form_builder 1.0.1
dynamic_json_form_builder: ^1.0.1 copied to clipboard
A highly advanced, reusable, JSON-driven form builder for Flutter. Supports all major field types, custom theming, validation, conditional logic, and custom user-defined fields.
dynamic_json_form_builder #
Overview #
dynamic_json_form_builder is a highly advanced, reusable, and extensible JSON-driven form builder for Flutter. Effortlessly build dynamic, beautiful, and responsive forms from JSON with support for all major field types, custom theming, validation (sync/async), conditional logic, and user-defined custom fields. Perfect for app developers who want to create flexible forms without writing repetitive UI code.
Features #
- 📝 All major field types: text, dropdown, date, checkbox, radio, multi-select, file upload, and more
- 🎨 Custom theming: Light, dark, and fully custom themes
- ✅ Validation: Synchronous and asynchronous validation
- 🔄 Conditional logic: Show/hide fields based on other values
- 🧩 Custom fields: Plug in your own field widgets
- 📱 Responsive: Adapts to all screen sizes (MediaQuery, AutoSizeText)
- 💬 Placeholder/hint support: For all field types
- 🏷️ Label placement: Above or beside fields
- 🗂️ Section/group support: Organize fields in rows or columns
- 🛠️ Extensible: Easily add new field types or behaviors
- 🖥️ Platform support: Android, iOS, Web, Windows, macOS, Linux
Installation #
Add to your pubspec.yaml:
dependencies:
dynamic_json_form_builder: ^1.0.0
Then run:
flutter pub get
Usage Example #
import 'package:dynamic_json_form_builder/dynamic_json_form_builder.dart';
final fields = [
{
"key": "email",
"type": "email",
"label": "Email",
"placeholder": "Enter your email",
"required": true,
},
{
"key": "gender",
"type": "dropdown",
"label": "Gender",
"options": ["Male", "Female", "Other"],
"placeholder": "Select your gender",
},
// ... more fields ...
];
class MyFormPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return JsonFormBuilder(
config: {"fields": fields},
onChanged: (data) => print(data),
// theme: FormTheme(...), // Optional: custom theming
);
}
}
API Reference #
Key Widgets & Classes #
-
JsonFormBuilder
The main widget. Takes a JSON config and builds the form. -
FormTheme
Customizes colors, text styles, borders, spacing, and more. -
FieldConfig
Model for each field's configuration. -
Custom Field Support
PasscustomFieldBuildersto support your own widgets.
Main Parameters
| Parameter | Type | Description |
|---|---|---|
config |
Map<String, dynamic> |
JSON config for the form |
onChanged |
Function(Map) |
Callback for form value changes |
theme |
FormTheme? |
Custom theme for the form |
customFieldBuilders |
Map<String, FieldWidgetBuilder>? |
Add your own field types |
Customization #
-
Theming:
Use theFormThemeclass to fully customize colors, fonts, borders, spacing, and more. -
Custom Fields:
Pass acustomFieldBuildersmap to add your own field widgets. -
Validation:
AddvalidatororasyncValidatorin your field config for custom validation logic. -
Conditional Logic:
Use thevisibleIfproperty in field config to show/hide fields based on other values.
Platform Support #
- ✅ Android
- ✅ iOS
- ✅ Web
- ✅ Windows
- ✅ macOS
- ✅ Linux
Screenshots #
Add your own screenshots or GIFs here!
[Profile Form Example] #
Roadmap #
- ❌ Field grouping/sections
- ❌ More built-in field types (slider, rating, etc.)
- ❌ Drag-and-drop form builder UI
- ❌ Localization/i18n support
- ❌ More advanced conditional logic
Contributing #
Contributions are welcome! To get started:
- Fork the repo and clone it.
- Create a new branch for your feature or bugfix.
- Write clear, well-documented code and tests.
- Open a pull request describing your changes.
Please see CONTRIBUTING.md for more details.
License #
This project is licensed under the MIT License. See the LICENSE file for details.
Contact #
Maintained by Chirag Chaudhary.
For issues, please use the issue tracker.