为什么我未传递事件时BlocBuilder会调用

时间:2020-04-08 09:47:46

标签: flutter dart bloc flutter-bloc

我拥有AuthBloc,而不是管理用户身份验证。当我想从LessonsScreen推送新页面时,为什么BlocBuilder会调用?我不知道如何解决。

@override
Widget build(BuildContext context) {
  return MaterialApp(
    home: BlocBuilder<AuthBloc, AuthState>(
      builder: (context, state) {
        if (state is AuthUninitialized) {
          return SplashScreen();
        }
        if (state is AuthAuthenticated) {
           Navigator.of(context).popUntil((route) => route.isFirst);

          if (state.isRegistered) {
            return LessonsScreen();
          }

          return EditProfileScreen();
        }
        if (state is AuthUnauthenticated) {
          return LoginPhoneScreen();
        }
        return null;
      },
    ),
  );
}

0 个答案:

没有答案