register_form - Added register forms

This commit is contained in:
Matthew Patrick 2022-04-25 20:42:59 +07:00
parent 69c7b1d1d6
commit 36221885ff

View file

@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:lottie/lottie.dart';
import 'package:flutter_form_builder/flutter_form_builder.dart';
class Register_Form extends StatefulWidget {
Register_Form({Key? key}) : super(key: key);
@ -8,6 +9,8 @@ class Register_Form extends StatefulWidget {
State<Register_Form> createState() => _Register_FormState();
}
final _formKey = GlobalKey<FormBuilderState>();
class _Register_FormState extends State<Register_Form> {
@override
Widget build(BuildContext context) {
@ -42,6 +45,20 @@ class _Register_FormState extends State<Register_Form> {
),
],
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 25),
child: FormBuilder(
key: _formKey,
child: Column(
children: [
makeInput(label: "First Name"),
makeInput(label: "Last Name"),
makeInput(label: "Email Address"),
makeInput(label: "Password", obscureText: true)
],
),
),
),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 35),
child: Container(
@ -91,3 +108,43 @@ class _Register_FormState extends State<Register_Form> {
);
}
}
Widget makeInput({label, obscureText = false}) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
label,
style: const TextStyle(
fontSize: 12, fontWeight: FontWeight.bold, color: Colors.white),
),
const SizedBox(
height: 5,
),
FormBuilderTextField(
initialValue: "",
name: label,
obscureText: obscureText,
style: const TextStyle(color: Colors.white),
decoration: const InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0, horizontal: 10),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.red,
),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.white,
),
),
border:
OutlineInputBorder(borderSide: BorderSide(color: Colors.white)),
),
),
const SizedBox(
height: 10,
)
],
);
}