Add HomeCubit and HomeState classes

This commit adds the HomeCubit class along with its corresponding HomeState
class. It also includes necessary imports and updates references to the
previously used SpacesCubit to the new HomeCubit in various files.
handled the multible onCreate -- HomeCubit
This commit is contained in:
Mohammad Salameh
2024-03-24 14:43:13 +03:00
parent c0bfd24751
commit e17c0af144
15 changed files with 72 additions and 77 deletions

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.dart';
import 'package:syncrow_app/features/app_layout/bloc/home_cubit.dart';
import '../../../../generated/assets.dart';
@ -12,7 +12,7 @@ class AppBody extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<SpacesCubit, SpacesState>(
return BlocBuilder<HomeCubit, SpacesState>(
builder: (context, state) {
return Container(
width: MediaQuery.sizeOf(context).width,
@ -26,7 +26,7 @@ class AppBody extends StatelessWidget {
opacity: 0.4,
),
),
child: BlocConsumer<SpacesCubit, SpacesState>(
child: BlocConsumer<HomeCubit, SpacesState>(
listener: (context, state) {
if (state is GetSpacesError) {
ScaffoldMessenger.of(context).showSnackBar(
@ -39,7 +39,7 @@ class AppBody extends StatelessWidget {
builder: (context, state) {
return state is! GetSpacesLoading ||
state is! GetSpaceRoomsLoading
? SpacesCubit.get(context).pages[SpacesCubit.pageIndex]
? HomeCubit.get(context).pages[HomeCubit.pageIndex]
: const Center(child: CircularProgressIndicator());
},
),