easy_form_builder 1.0.4
easy_form_builder: ^1.0.4 copied to clipboard
Flutter easy form builder allow user to create form easily. Follow example to understand features
example/lib/main.dart
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:easy_form_builder/easy_form_builder.dart';
import 'package:easy_form_builder_example/ws_form.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
Map<String, dynamic> values = {};
var formKey = GlobalKey<FormState>();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Dynamic Form Plugin example app'),
),
body: Center(
child: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: EasyFormBuilder(
formKey: formKey,
params: WsFormTypes.simpleContact.wsParams,
paramValues: values,
icon: true,
forcedColumnNumber: 2,
),
),
SizedBox(
height: 20,
),
ElevatedButton(
onPressed: () {
if (formKey.currentState!.validate()) {
formKey.currentState!.save();
debugPrint(json.encode(values));
}
},
child: const Text("Submit"),
),
],
),
),
),
),
);
}
}