mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-17 10:35:10 +00:00
51 lines
1.5 KiB
Dart
51 lines
1.5 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 '../../../../generated/assets.dart';
|
|
|
|
class AppBody extends StatelessWidget {
|
|
const AppBody({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<HomeCubit, HomeState>(
|
|
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: 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.get(context).pages[HomeCubit.pageIndex]
|
|
: const Center(child: CircularProgressIndicator());
|
|
},
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|