Fixed the overflow in the login screen, the page is scrollable.

- Fixed Scrolling wasent working in login screen
- Changed Home page to indexed based view instead of PageView
This commit is contained in:
Mohammad Salameh
2024-03-19 13:29:12 +03:00
parent 79279180df
commit 42051bb977
10 changed files with 148 additions and 373 deletions

View File

@ -17,10 +17,8 @@ class NavCubit extends Cubit<NavState> {
static NavCubit of(context) => BlocProvider.of<NavCubit>(context);
//functoin to do the important work when the user logs out
static clear() {
pageIndex = 0;
pageController.jumpToPage(0);
}
static int pageIndex = 0;
@ -146,12 +144,9 @@ class NavCubit extends Cubit<NavState> {
const MenuView(),
];
static final PageController pageController = PageController();
void updatePageIndex(int index) {
pageIndex = index;
pageController.animateToPage(index,
duration: const Duration(milliseconds: 150), curve: Curves.easeIn);
emit(NavChangePage());
}
}

View File

@ -6,6 +6,7 @@ import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.dart';
import 'package:syncrow_app/features/app_layout/view/widgets/app_body.dart';
import 'package:syncrow_app/features/app_layout/view/widgets/default_app_bar.dart';
import 'package:syncrow_app/features/app_layout/view/widgets/default_nav_bar.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/navigation/routing_constants.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
@ -14,8 +15,15 @@ class AppLayout extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocProvider(
create: (context) => SpacesCubit(),
return MultiBlocProvider(
providers: [
BlocProvider(
create: (context) => SpacesCubit(),
),
BlocProvider(
create: (context) => DevicesCubit(),
),
],
child: BlocListener<SpacesCubit, SpacesState>(
listener: (context, state) {
if (state is SpacesError) {

View File

@ -38,11 +38,7 @@ class AppBody extends StatelessWidget {
},
builder: (context, state) {
return state is! SpacesLoading || state is! SpaceRoomsLoading
? PageView(
physics: const NeverScrollableScrollPhysics(),
controller: NavCubit.pageController,
children: NavCubit.of(context).pages,
)
? NavCubit.of(context).pages[NavCubit.pageIndex]
: const Center(child: CircularProgressIndicator());
},
),