textinput_builder 0.0.2

SDKflutter
Platformandroidioswindowslinuxmacosweb

A simple text form 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

Usage

JSON Schema

{
  "formData": [
    {
      "id": '123',
      "label": "First Name",
      "type": "text",
      "isRequired": true,
    },
  ]
}

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),
            )
          ],
        ),
      ),
    ));
  }
}

Additional information

PropertiesDescription
dataA map that is required to generate the text builder form.
onSubmitA function that will return json response data when submit button is pressed