0 purchases
textinput builder
A simple text form builder that will let you create a form from a json data
Getting started #
Add the following to your pubspec.yaml file:
dependencies:
textform_builder: ^0.0.1
copied to clipboard
Usage #
JSON Schema
{
"formData": [
{
"id": '123',
"label": "First Name",
"type": "text",
"isRequired": true,
},
]
}
copied to clipboard
How to use widget
import 'package:flutter/material.dart';
import 'package:textform_builder/textform_builder.dart';
class MyHomePage extends StatelessWidget {
const MyHomePage({Key? key}) : super(key: key);
onSubmit(data) {
debugPrint(data.toString());
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Container(
margin: const EdgeInsets.only(top: 50),
padding: const EdgeInsets.symmetric(horizontal: 50),
child: Column(
children: [
const Text(
'Sample Form',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.w700),
),
const SizedBox(height: 20),
FormBuilder(
data: sampleJson,
onSubmit: (val) => onSubmit(val),
)
],
),
),
));
}
}
copied to clipboard
Additional information #
Properties
Description
data
A map that is required to generate the text builder form.
onSubmit
A function that will return json response data when submit button is pressed
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.