【发布时间】:2020-04-15 21:57:42
【问题描述】:
在我的应用程序中输入电子邮件时收到此错误。 我一直在输入 hamtaco123@gmail.com 之类的内容,并且必须至少有 6 个字符长
.. .. ..
class _RegistrationScreenState extends State<RegistrationScreen> {
final _auth = FirebaseAuth.instance;
String email;
String password;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: <Widget>[
Hero(
tag: 'logo',
child: Container(
height: 200.0,
child: Image.asset('images/logo.png'),
),
),
SizedBox(
height: 48.0,
),
TextField(
textAlign: TextAlign.center,
keyboardType: TextInputType.emailAddress,
onChanged: (value) {
email = value;
},
decoration:
kTextFieldDecoration.copyWith(hintText: 'Enter your Email'),
),
SizedBox(
height: 8.0,
),
TextField(
textAlign: TextAlign.center,
obscureText: true,
onChanged: (value) {
password = value;
},
decoration: kTextFieldDecoration.copyWith(
hintText: 'Enter your Password'),
),
SizedBox(
height: 24.0,
),
RoundedButton(
text: 'Register',
color: Colors.blueAccent,
onPressed: () async {
try {
final FirebaseUser newUser =
(await _auth.createUserWithEmailAndPassword(
email: email,
password: password,
))
.user;
if (newUser != null) {
Navigator.pushNamed(context, ChatScreen.id);
}
} catch (e) {
print(e);
}
}),
],
),
),
);
}
}
--------------
--------------
--------------
--------------
--------------
--------------
【问题讨论】:
标签: flutter dart firebase-authentication