解耦登录中TCP连接的必要,使其能够快速响应登录。3.5秒 降低到 <1秒

This commit is contained in:
2026-05-06 16:09:16 +08:00
parent 9b918a90df
commit ad68952731
3 changed files with 22 additions and 7 deletions

View File

@@ -39,7 +39,9 @@ class _LoginPageState extends State<LoginPage> {
body: BlocListener<LoginCubit, LoginState>(
listener: (context, state) {
if (state is LoginSuccess) {
context.go(RoutePaths.home);
// 登录成功后,AuthCubit 状态已更新
// GoRouter 的 redirect 会自动检测到已登录状态并跳转到首页
// 不需要手动调用 context.go
} else if (state is LoginFailure) {
// 可以在这里弹出简洁的黑白提示框
ScaffoldMessenger.of(context).showSnackBar(SnackBar(content: Text('登录失败,${state.message}')));