-
Notifications
You must be signed in to change notification settings - Fork 0
/
form em pass.txt
52 lines (42 loc) · 1.41 KB
/
form em pass.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
class EmployeeForm extends StatefulWidget {
@override
_EmployeeFormState createState() => _EmployeeFormState();
}
class _EmployeeFormState extends State<EmployeeForm> {
final _formKey = GlobalKey<FormState>();
late String _password;
late String _email;
void submitform() {
print("Here");
showDialog(
context: context,
builder: (BuildContext context) => AlertDialog(
content: Text("hi"),
));
}
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
for em and pw (pw extra => obscureText: true,)
TextFormField(
decoration: InputDecoration(
labelText: 'Email',
),
validator: (value) {
if (value!.isEmpty) {
return 'Please enter an email';
}
return null;
},
onSaved: (value) {
_email = value!;
},
),
submit on pressed
onPressed: () {
if (_formKey.currentState!.validate()) {
_formKey.currentState!.save();
// Do something with the form data
submitform();
}
},