Во время активации валидатора в textFormFeild его высота уменьшается, а круговая граница почти сворачивается. Я искал эту проблему в Интернете и получил этот github https://github.com/flutter/flutter/issues/15400 Но предложил решение из Обтекание TextFormField в родительском элементе с фиксированной высотой, например container или или size box и Предоставление helperText одного пробела. не работает для меня.
Можно ли показать вспомогательный текст (текст ошибки) под "textformfeild"? Так что высота крикулярной границы или не двигаться вверх
Вот мой код textFormFeilds
Form(
key: _formKey,
child: Container(
margin: EdgeInsets.only(top: 20),
width: deviceSize.width,
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(50)),
child: Container(
height: 38,
width: deviceSize.width * 0.9,
color: Colors.white.withOpacity(0.7),
//
// >>>>>>>>> E M A I L F O R M F E I L D
//
child: TextFormField(
helperText: '',
validator: (val) {
if (val.isEmpty) {
return 'Please type an email';
}
},
onChanged: (val) {
setState(() => _email = val);
},
maxLines: 1,
obscureText: false,
cursorColor: Colors.brown,
decoration: InputDecoration(
border: new OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(50),
),
),
labelText: "Enter your Email address",
labelStyle: TextStyle(
color: Colors.brown.withOpacity(0.8),
fontSize: 15
),
filled: false,
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(50),
borderSide: const BorderSide(
color: Colors.brown, width: 0.7),
),
//
// >>>>>>>>> Email Icon
//
prefixIcon: IconButton(
color: Colors.black.withOpacity(0.5),
icon: Icon(
Icons.email,
size: 15,
color: Colors.brown.withOpacity(0.7),
),
onPressed: () {},
),
),
),
),
),
SizedBox(
height: 15,
),
ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(50)),
child: Container(
height: 38,
width: deviceSize.width * 0.9,
color: Colors.white.withOpacity(0.7),
//
// >>>>>>>>> P A S S F O R M F E I L D
//
child: TextFormField(
//autovalidate: true,
decoration: InputDecoration(
helperText: '',
border: new OutlineInputBorder(
borderRadius: BorderRadius.all(
Radius.circular(50),
),
),
labelText: "Enter your password",
labelStyle: TextStyle(
color: Colors.brown.withOpacity(0.8),
fontSize: 15
),
filled: false,
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(50),
borderSide: const BorderSide(
color: Colors.brown, width: 0.7
),
),
//
// >>>>>>>>> Pass Icon
//
prefixIcon: IconButton(
color: Colors.black.withOpacity(0.5),
icon: Icon(
Icons.lock,
size: 15,
color: Colors.brown.withOpacity(0.7),
),
onPressed: () {},
),
),
validator: (val) {
if (val.length < 6) {
return 'Length of password should be greater then 6 elements';
}
},
onChanged: (val) {
setState(() => _email = val);
},
maxLines: 1,
obscureText: false,
cursorColor: Colors.brown,
),
),
),
SizedBox(
height: 15,
child: Text(_error),
),
// ------------------------------------------------------ L O G I N B U T T O N
FlatButton(
onPressed: () async {
if (_formKey.currentState.validate()) {
setState(
() => loading = true,
);
dynamic result =
await _auth.signInWithEmailAndPassword(
_email.trim(), _password);
if (result == null) {
setState(() {
_error =
"Couldn't sign in with those credentials";
loading = false;
print("Invalid");
});
} else {
setState(() {
loading = false;
print("Valid");
});
}
// else if (this.mounted) {
// setState(() {
// loading = false;
// });
// }
}
},
child: ClipRRect(
borderRadius:
BorderRadius.all(Radius.circular(50)),
child: Container(
height: 38,
width: deviceSize.width * 0.9,
color: Color(0xffA6714E).withOpacity(0.7),
child: Center(
child: Text(
"LOGIN",
style: TextStyle(
color: Colors.white,
fontFamily: 'Montserrat',
fontSize: 20,
),
),
),
),
),
),
],
),
),
)