Semi-implemented getting spaces feature

This commit is contained in:
Mohammad Salameh
2024-03-12 11:14:31 +03:00
parent 661d535960
commit 0f3cc453ce
25 changed files with 311 additions and 294 deletions

View File

@ -50,7 +50,7 @@ class AppBarHomeDropdown extends StatelessWidget {
const SizedBox(width: 5),
Expanded(
child: BodyMedium(
text: space.name,
text: space.name ?? "",
style: context.bodyMedium.copyWith(
fontSize: 15,
color: ColorsManager.textPrimaryColor,

View File

@ -1,6 +1,7 @@
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';
@ -25,10 +26,25 @@ class AppBody extends StatelessWidget {
opacity: 0.4,
),
),
child: PageView(
physics: const NeverScrollableScrollPhysics(),
controller: NavCubit.of(context).pageController,
children: NavCubit.of(context).pages,
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,
);