Files
syncrow-app/lib/features/app_layout/view/widgets/app_body.dart
Mohammad Salameh 80d424f114 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
2024-04-15 12:03:25 +03:00

48 lines
1.4 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import 'package:syncrow_app/generated/assets.dart';
class AppBody extends StatelessWidget {
const AppBody({
super.key,
});
@override
Widget build(BuildContext context) {
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,
height: MediaQuery.sizeOf(context).height,
decoration: const BoxDecoration(
image: DecorationImage(
image: AssetImage(
Assets.imagesBackground,
),
fit: BoxFit.cover,
opacity: 0.4,
),
),
child: state is! GetSpacesLoading
? state is! GetSpaceRoomsLoading
? HomeCubit.getInstance().pages[HomeCubit.pageIndex]
: const Center(child: CircularProgressIndicator())
: const Center(child: CircularProgressIndicator()),
);
},
);
}
}