mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 20:34:55 +00:00
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:
@ -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/features/devices/bloc/devices_cubit.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||
@ -13,9 +13,9 @@ class DefaultNavBar extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<SpacesCubit, SpacesState>(
|
||||
return BlocBuilder<HomeCubit, SpacesState>(
|
||||
builder: (context, state) {
|
||||
var cubit = SpacesCubit.get(context);
|
||||
var cubit = HomeCubit.get(context);
|
||||
return SizedBox(
|
||||
height: Constants.bottomNavBarHeight,
|
||||
child: BottomNavigationBar(
|
||||
@ -25,11 +25,11 @@ class DefaultNavBar extends StatelessWidget {
|
||||
if (DevicesCubit.get(context).chosenCategoryView != null) {
|
||||
DevicesCubit().clearCategoriesSelection(context);
|
||||
}
|
||||
if (SpacesCubit.get(context).selectedRoom != null) {
|
||||
SpacesCubit.get(context).unselectRoom();
|
||||
if (HomeCubit.get(context).selectedRoom != null) {
|
||||
HomeCubit.get(context).unselectRoom();
|
||||
}
|
||||
},
|
||||
currentIndex: SpacesCubit.pageIndex,
|
||||
currentIndex: HomeCubit.pageIndex,
|
||||
selectedItemColor: ColorsManager.primaryColor,
|
||||
selectedLabelStyle: const TextStyle(
|
||||
color: ColorsManager.primaryColor,
|
||||
@ -39,7 +39,7 @@ class DefaultNavBar extends StatelessWidget {
|
||||
unselectedItemColor: Colors.grey,
|
||||
type: BottomNavigationBarType.fixed,
|
||||
elevation: 0,
|
||||
items: cubit.bottomNavItems,
|
||||
items: HomeCubit.bottomNavItems,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user