从不同路线注销不会更改屏幕



我的顶级小部件是提供者,它们的子部件是Material App。在Material应用程序中,作为主路径,我正在从我的身份验证提供商那里检查用户是否登录,所以我会显示不同的屏幕。在我的抽屉里,我有一个注销按钮,可以注销用户并通知监听器。如果我刚启动应用程序,注销就可以了,但如果我导航到其他路线,那么注销就不会把我带到身份验证屏幕。

return MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
fontFamily: 'IBM Plex Sans',
textTheme: const TextTheme(
headline1: TextStyle(
color: primaryColor,
fontSize: 20,
fontWeight: FontWeight.w400,
),
caption: TextStyle(
fontSize: 15,
color: Colors.grey,
fontWeight: FontWeight.w600,
),
),
appBarTheme: const AppBarTheme(
backgroundColor: Color(0xFFFCAA32),
),
),
home: authData.isAuth ? CatagoriesScreen() : AuthScreen(),

我通过向材料应用程序提供密钥UniqueKey()来修复它。

最新更新