add login and input
This commit is contained in:
37
lib/widgets/my_form_field.dart
Normal file
37
lib/widgets/my_form_field.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class MyFormField extends StatelessWidget {
|
||||
const MyFormField({
|
||||
super.key,
|
||||
this.validator,
|
||||
required this.labelText,
|
||||
required this.filled,
|
||||
required this.fillColor,
|
||||
required this.keyboardType,
|
||||
required this.userController,
|
||||
});
|
||||
|
||||
final TextEditingController userController;
|
||||
final String labelText;
|
||||
final bool filled;
|
||||
final Color fillColor;
|
||||
final TextInputType keyboardType;
|
||||
final String? Function(String?)? validator;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return TextFormField(
|
||||
autovalidateMode: AutovalidateMode.onUserInteraction,
|
||||
style: const TextStyle(color: Colors.black),
|
||||
controller: userController,
|
||||
decoration: InputDecoration(
|
||||
labelText: labelText,
|
||||
filled: filled,
|
||||
fillColor: fillColor,
|
||||
),
|
||||
keyboardType: keyboardType,
|
||||
validator: validator,
|
||||
obscureText: labelText == 'Password' ? true : false,
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user