Refactor code for consistency and readability

- Removed unused imports and commented-out code
- Updated class inheritance for AuthState subclasses
- Reorganized code structure for better readability
- Cleaned up debug print statements and replaced with dart:developer logs
This commit is contained in:
Mohammad Salameh
2024-04-15 12:03:25 +03:00
parent cfc395e210
commit 80d424f114
13 changed files with 162 additions and 77 deletions

View File

@ -12,7 +12,16 @@ class AppBody extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<HomeCubit, HomeState>(
return BlocConsumer<HomeCubit, HomeState>(
listener: (context, state) {
if (state is GetSpacesError) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(state.errMessage),
),
);
}
},
builder: (context, state) {
return Container(
width: MediaQuery.sizeOf(context).width,
@ -26,24 +35,11 @@ class AppBody extends StatelessWidget {
opacity: 0.4,
),
),
child: BlocConsumer<HomeCubit, HomeState>(
listener: (context, state) {
if (state is GetSpacesError) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text(state.errMessage),
),
);
}
},
builder: (context, state) {
return state is! GetSpacesLoading
? state is! GetSpaceRoomsLoading
? HomeCubit.getInstance().pages[HomeCubit.pageIndex]
: const Center(child: CircularProgressIndicator())
: const Center(child: CircularProgressIndicator());
},
),
child: state is! GetSpacesLoading
? state is! GetSpaceRoomsLoading
? HomeCubit.getInstance().pages[HomeCubit.pageIndex]
: const Center(child: CircularProgressIndicator())
: const Center(child: CircularProgressIndicator()),
);
},
);