json_to_form_3

Last updated:

0 purchases

json_to_form_3 Image
json_to_form_3 Images
Add to Cart

Description:

json to form 3

Json to Form #



A complete form builder for all your needs
Maintainer : [Saravana]
Specs #

This library allows you to create a complete form from a json file with
multiple types of fields text , checkbox, multiselect , datetime , date , time , and file upload.
This package also provides additional remark options.
It has been written 100% in Dart. ❤️






Installing #
Add the following to your pubspec.yaml file:
dependencies:
simple_form_builder: ^0.0.18
copied to clipboard


Simple Usage #
To integrate the Simple form builder all you need to do is follow the given JSON schema and pass it to the formBuilder widget
JSON Schema #

// The complete sample is provided in the global folder that can be used as a reference

{
"status": 1,
"data": [
{
"questions": [
{
"question_id": String,
"fields": ["abvoe 40km/h", "below 40km/h", "0km/h"],
"_id": "60dc6a3dc9fe14577c30d271",
"title": "Please provide the speed of vehicle?",
"description": "please select one option given below",
"remark": true,
"type": "multiple",
"is_mandatory": true
},
{
"question_id": String,
"fields": [],
"_id": "60dc6a3dc9fe14577c30d271",
"title": "Name",
"placeholder": "enter a name",
"description": "please enter a name here",
"remark": true,
"type": "text",
"is_mandatory": true
}
]
}
]
}
copied to clipboard

Widget Implementation #
import 'package:flutter/material.dart';
import 'package:simple_form_builder/formbuilder.dart';
import 'package:simple_form_builder/global/constant.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'FormBuilder Example',
home: Scaffold(
appBar: AppBar(
title: Text('Material App Bar'),
),
body: SingleChildScrollView(
child: Column(
children: [
FormBuilder(
initialData: sampleData,
index: 0,
showIndex:true,
// showPrefix
//radioIcon
//checklistIcon
onSubmit: (val) {
print(val);
},
),
],
),
),
),
);
}
}
copied to clipboard

Custom Usage #
There are several options that allow for more control:



Properties
Description




initialData
This is the map that is required to generate the form. the sample JSON format is given in the constant.dart file


index
If the data contains mutiple forms passing the index of the form will show the question of that perticular form


onSubmit
This function will take in the map value and pass it to the given function when submit button is pressed


showPrefix
This toggle will enable or disable prefix icon before the question


onUpload
This contains the file uploaded by user in String


showIndex
to specify weather to show numbering or not

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.