removed snackbar calling in any place in the app except in the intercepter to improve

readability and reduce duplication of error message display logic.
This commit is contained in:
Mohammad Salameh
2024-04-15 15:44:32 +03:00
parent 80d424f114
commit dd90a2133f
6 changed files with 50 additions and 54 deletions

View File

@ -20,11 +20,11 @@ class AppLayout extends StatelessWidget {
return BlocConsumer<AuthCubit, AuthState>(
listener: (context, state) {
if (state is AuthError) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(state.message),
),
);
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(state.message),
// ),
// );
Navigator.of(context)
.popUntil((route) => route.settings.name == Routes.authLogin);
}
@ -35,11 +35,11 @@ class AppLayout extends StatelessWidget {
child: BlocConsumer<HomeCubit, HomeState>(
listener: (context, state) async {
if (state is GetSpacesError) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(state.errMessage),
),
);
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(
// content: Text(state.errMessage),
// ),
// );
Navigator.of(context).popUntil(
(route) => route.settings.name == Routes.authLogin);
}