小编eli*_*003的帖子

在 flutter 中验证电子邮件时,不会调用 onAuthStateChanged

当用户在我的应用程序中注册时,他会收到一封验证电子邮件。-listeneronAuthStateChanged在使用创建用户时被调用createUserWithEmailAndPassword,但在电子邮件验证后不会被调用。

我有一个单独的类来处理所有身份验证。以下方法是注册用户

Future<FirebaseUser> signUpUser(email, password) async {
final FirebaseUser user = await _auth.createUserWithEmailAndPassword(email: email, password: password);

assert (user != null);
assert (await user.getIdToken() != null);

return user;
}
Run Code Online (Sandbox Code Playgroud)

在我的StatefulWidget中使用这个方法调用这个方法

void _signUpUser() async {
try {
  await Auth().signUpUser(_email, _password)
    ..sendEmailVerification();
} catch (e) {
  print(e.toString());
}
}
Run Code Online (Sandbox Code Playgroud)

并按照我的方法onAuthStateChanged设置initStateStatefulWidget

  FirebaseAuth.instance.onAuthStateChanged.listen((user) {
  print("Auth State Changed!");
  if (user.isEmailVerified) {
    print("EMail verified!");
  }
  }
Run Code Online (Sandbox Code Playgroud)

firebase firebase-authentication flutter

8
推荐指数
1
解决办法
3601
查看次数

展开 Widget 以填充 ListView 中的剩余空间

在此输入图像描述

如上图所示,我希望小部件 2 始终至少是剩余可用空间的高度。

但是小部件 2 可能包含太多的 ListTiles,因此如果不滚动它们就无法显示。但是滚动应该会影响小部件 1 和小部件 2。实现这样的事情的最佳方法是什么?

dart flutter

5
推荐指数
1
解决办法
5022
查看次数

标签 统计

flutter ×2

dart ×1

firebase ×1

firebase-authentication ×1