I created this code snippet to create a login web form in flutter web application, in which I used TextFormField, it is displayed well but when I try to input any characters in this field, it doesn't respond and no input is taken, how can this be solved please?
class LoginForm extends StatefulWidget{
@override
LoginFormState createState(){
return LoginFormState();
}
}
class LoginFormState extends State<LoginForm>{
final _formKey = GlobalKey<FormState>();
@override
Widget build(BuildContext context) {
// TODO: implement build
return Form(
key: _formKey,
child: Column(
children: <Widget>[
Row(
children: <Widget>[
// Email input field
Container(
width: 120.0,
child: Text(
"Email: *",
textAlign: TextAlign.left,
style: TextStyle(
color: Colors.black,
fontSize: 18.0,
fontWeight: FontWeight.w500,
fontFamily: 'Merriweather',
),
),
),
SizedBox(width: 40.0,),
Container(
width: MediaQuery.of(context).size.width / 4.0,
child: TextFormField(
keyboardType: TextInputType.emailAddress,
cursorColor: Colors.black,
style: TextStyle(
fontSize: 14.0,
),
decoration: InputDecoration(
hintText: 'e@x.y',
contentPadding: EdgeInsets.all(10.0),
enabledBorder: UnderlineInputBorder(
borderSide: BorderSide(
color: Colors.black87,
),
borderRadius: BorderRadius.circular(10.0),
),
),
validator: (value){
if(value.isEmpty){
return "Please enter your email!";
}
return "yayyy";
},
),
),
]
),
Expected: user can enter input in the textFormfield Error: User can't enter any input and the scroll keep blinking only
Aucun commentaire:
Enregistrer un commentaire