formify 1.1.0 formify: ^1.1.0 copied to clipboard
Formify is a versatile and customizable form handling library for Flutter, designed to simplify the process of creating and managing forms in your Flutter applications
import 'package:example/form_demo.dart';
import 'package:flutter/material.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Formify Demo',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
useMaterial3: true,
),
home: const MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key});
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final formDemo = FormDemo();
@override
void initState() {
super.initState();
formDemo.setInitialValues({
'first_name': 'Agung',
'last_name': 'Budi',
});
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text('Formify Demo'),
),
body: SingleChildScrollView(
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 16),
child: Column(
children: [
...formDemo.getWidgets(),
const SizedBox(height: 16),
SizedBox(
width: double.infinity,
height: 50,
child: FilledButton(
onPressed: () {
if (formDemo.isFormValid()) {
//DO SOMETHING
}
},
child: const Text('Login'),
),
),
],
),
),
);
}
}