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 'package:syncrow_app/utils/resource_manager/constants.dart';
class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
@ -9,7 +9,7 @@ class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<SpacesCubit, SpacesState>(
return BlocBuilder<HomeCubit, SpacesState>(
builder: (context, state) {
return Padding(
padding: const EdgeInsets.only(
@ -19,15 +19,14 @@ class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
backgroundColor: Colors.transparent,
leadingWidth: 150,
toolbarHeight: Constants.appBarHeight,
leading: SpacesCubit.spaces != null
? SpacesCubit.spaces!.isNotEmpty
? SpacesCubit.appBarLeading[SpacesCubit()
.bottomNavItems[SpacesCubit.pageIndex]
.label]
leading: HomeCubit.spaces != null
? HomeCubit.spaces!.isNotEmpty
? HomeCubit.appBarLeading[
HomeCubit.bottomNavItems[HomeCubit.pageIndex].label]
: null
: null,
actions: SpacesCubit.appBarActions[
SpacesCubit().bottomNavItems[SpacesCubit.pageIndex].label],
actions: HomeCubit.appBarActions[
HomeCubit.bottomNavItems[HomeCubit.pageIndex].label],
),
);
},