Commit 907782b8 authored by 张宏's avatar 张宏

1111

parent b5abe691
...@@ -188,42 +188,21 @@ class _MyAppState extends State<MyApp> { ...@@ -188,42 +188,21 @@ class _MyAppState extends State<MyApp> {
), ),
// BlocProvider<CounterBloc>(create: (_) => CounterBloc()), // BlocProvider<CounterBloc>(create: (_) => CounterBloc()),
], ],
child: MultiBlocListener( child: Stack(
listeners: [ children: [
// // AuthBloc 监听器 - 处理登录/Token 过期/登出 MaterialApp.router(
// BlocListener<AuthBloc, AuthState>( scaffoldMessengerKey: _scaffoldMessengerKey,
// listener: (context, state) { routerConfig: _appRouter.config(),
// if (state is AuthSuccess) { debugShowCheckedModeBanner: false,
// _appRouter.replaceAll([const DefaultLayoutRoute()]); builder: (context, child) {
// } // 每次页面重建时重新隐藏状态栏,防止路由切换后状态栏重新出现
// if (state is AuthTokenExpired) { SystemChrome.setEnabledSystemUIMode(
// _silentLogin(); SystemUiMode.manual, overlays: []);
// } return child ?? const SizedBox.shrink();
// if (state is AuthLoggedOut) { },
// _silentLogin(); ),
// } if (_isInitializing) _buildSplash(),
// },
// ),
// 未来在这里添加其他 Bloc 的监听器:
// BlocListener<UserBloc, UserState>(listener: ...),
// BlocListener<SettingsBloc, SettingsState>(listener: ...),
], ],
child: Stack(
children: [
MaterialApp.router(
scaffoldMessengerKey: _scaffoldMessengerKey,
routerConfig: _appRouter.config(),
debugShowCheckedModeBanner: false,
builder: (context, child) {
// 每次页面重建时重新隐藏状态栏,防止路由切换后状态栏重新出现
SystemChrome.setEnabledSystemUIMode(
SystemUiMode.manual, overlays: []);
return child ?? const SizedBox.shrink();
},
),
if (_isInitializing) _buildSplash(),
],
),
), ),
); );
}, },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment