mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 01:56:19 +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:
@ -2,7 +2,7 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.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/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';
|
||||
@ -18,13 +18,13 @@ class AppLayout extends StatelessWidget {
|
||||
return MultiBlocProvider(
|
||||
providers: [
|
||||
BlocProvider(
|
||||
create: (context) => SpacesCubit(),
|
||||
create: (context) => HomeCubit(),
|
||||
),
|
||||
BlocProvider(
|
||||
create: (context) => DevicesCubit(),
|
||||
),
|
||||
],
|
||||
child: BlocListener<SpacesCubit, SpacesState>(
|
||||
child: BlocListener<HomeCubit, SpacesState>(
|
||||
listener: (context, state) {
|
||||
if (state is GetSpacesError) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
@ -36,7 +36,7 @@ class AppLayout extends StatelessWidget {
|
||||
.popUntil((route) => route.settings.name == Routes.authLogin);
|
||||
}
|
||||
},
|
||||
child: BlocBuilder<SpacesCubit, SpacesState>(
|
||||
child: BlocBuilder<HomeCubit, SpacesState>(
|
||||
builder: (context, state) {
|
||||
return AnnotatedRegion(
|
||||
value: SystemUiOverlayStyle(
|
||||
@ -44,7 +44,7 @@ class AppLayout extends StatelessWidget {
|
||||
statusBarIconBrightness: Brightness.light,
|
||||
),
|
||||
child: SafeArea(
|
||||
child: BlocBuilder<SpacesCubit, SpacesState>(
|
||||
child: BlocBuilder<HomeCubit, SpacesState>(
|
||||
builder: (context, state) {
|
||||
return Scaffold(
|
||||
backgroundColor: ColorsManager.backgroundColor,
|
||||
|
Reference in New Issue
Block a user