mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 01:35:23 +00:00
55 lines
1.8 KiB
Dart
55 lines
1.8 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
|
import 'package:syncrow_app/features/app_layout/bloc/nav_cubit.dart';
|
|
import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.dart';
|
|
|
|
import '../../../../generated/assets.dart';
|
|
|
|
class AppBody extends StatelessWidget {
|
|
const AppBody({
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return BlocBuilder<NavCubit, NavState>(
|
|
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<SpacesCubit, SpacesState>(
|
|
listener: (context, state) {
|
|
if (state is SpacesError) {
|
|
ScaffoldMessenger.of(context).showSnackBar(
|
|
SnackBar(
|
|
content: Text(state.errMessage),
|
|
),
|
|
);
|
|
}
|
|
},
|
|
builder: (context, state) {
|
|
return state is! SpacesLoading
|
|
? PageView(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
controller: NavCubit.of(context).pageController,
|
|
children: NavCubit.of(context).pages,
|
|
)
|
|
: const Center(child: CircularProgressIndicator());
|
|
},
|
|
)
|
|
// NavCubit.of(context).currentPage,
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|