Last updated:
0 purchases
flutter simple form builder
You can create forms very easy in minimum lines of code
Features #
it can create form
Getting started #
just create list of MyFormObj
Usage #
import 'package:flutter/material.dart';
import 'package:flutter_simple_form_builder/flutter_form_builder.dart';
import 'package:flutter_simple_form_builder/form_obj.dart';
Future<void> main() async {
runApp(const MyApp());
}
class MyApp extends StatefulWidget {
const MyApp({
Key? key,
}) : super(key: key);
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
List<TextEditingController> controllers = [];
List<List<MyFormObj>> fullFormObjList = [
[
MyFormObj(
controller: TextEditingController(),
serverName: "firstname",
title: "firstname",
type: MyFormType.text),
],
[
MyFormObj(
controller: TextEditingController(),
serverName: "lastname",
title: "lastname",
type: MyFormType.text),
],
[
MyFormObj(
controller: TextEditingController(),
serverName: "birth_day",
title: "Birthday",
type: MyFormType.date,
readOnly: true,
),
],
[
MyFormObj(
controller: TextEditingController(),
serverName: "province",
title: "Province",
type: MyFormType.singleChoice,
readOnly: true,
choiceObjs: [
ChoiceObj(id: 0, title: "Germany"),
ChoiceObj(id: 1, title: "France"),
]),
],
[
MyFormObj(
controller: TextEditingController(),
serverName: "gender",
title: "Gender",
type: MyFormType.singleChoice,
readOnly: true,
choiceObjs: [
ChoiceObj(id: 0, title: "Male"),
ChoiceObj(id: 1, title: "Female"),
])
],
];
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
title: Text("Example"),
),
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text("Complete Form Please",style: TextStyle(fontSize: 18),),
MyFormBuilder(fullFormObjList: fullFormObjList,onSubmit: (map){
print(map);
},),
],
),
),
),
);
}
}
copied to clipboard
Additional information #
nothing
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.