返回的小部件的闪烁屏幕,呈斑点状

时间:2020-02-12 03:29:45

标签: flutter flutter-bloc

我是flutter的新手,我只是按照firebase登录flutter-bloc教程为我的应用执行相同的操作,

一切顺利,除了第一次加载屏幕。

home: BlocBuilder<AuthBloc, AuthState>(
    builder: (context, state) {
      if (state is Uninitialized) { <=== return regardless of the state
        return WelcomeScreen();
      } else if (state is Unauthenticated) { <=== return regardless of the state
        return LoginScreen(userRepository: _userRepository);
      } else if (state is Authenticated) {
        return HomeScreen( <=== return regardless of the state
          user: state.user,
          homeRepository: _homeRepository,
          userRepository: _userRepository,
        );
      }
      return WelcomeScreen();
    },

flutter-bloc main.dart

if条件返回每个屏幕,无论其状态如何,如果满足状态条件,则应打破条件并仅返回一个小部件。但这不是事实,它返回每个屏幕都很奇怪。

The flutter juggling after loading the screen

谢谢

0 个答案:

没有答案