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:
@ -14,11 +14,11 @@ import 'package:syncrow_app/services/api/network_exception.dart';
|
||||
import 'package:syncrow_app/services/api/spaces_api.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
|
||||
part 'spaces_state.dart';
|
||||
part 'home_state.dart';
|
||||
|
||||
class SpacesCubit extends Cubit<SpacesState> {
|
||||
SpacesCubit() : super(SpacesInitial()) {
|
||||
if (SpacesCubit.spaces != null) {
|
||||
class HomeCubit extends Cubit<SpacesState> {
|
||||
HomeCubit() : super(SpacesInitial()) {
|
||||
if (HomeCubit.spaces != null) {
|
||||
if (selectedSpace == null) {
|
||||
fetchSpaces().then((value) {
|
||||
if (selectedSpace != null) {
|
||||
@ -32,7 +32,7 @@ class SpacesCubit extends Cubit<SpacesState> {
|
||||
}
|
||||
}
|
||||
|
||||
static SpacesCubit get(context) => BlocProvider.of(context);
|
||||
static HomeCubit get(context) => BlocProvider.of(context);
|
||||
|
||||
static List<SpaceModel>? spaces;
|
||||
|
||||
@ -236,7 +236,7 @@ class SpacesCubit extends Cubit<SpacesState> {
|
||||
),
|
||||
};
|
||||
|
||||
var bottomNavItems = [
|
||||
static var bottomNavItems = [
|
||||
defaultBottomNavBarItem(icon: Assets.iconsDashboard, label: 'Dashboard'),
|
||||
// defaultBottomNavBarItem(icon: Assets.iconslayout, label: 'Layout'),
|
||||
defaultBottomNavBarItem(icon: Assets.iconsDevices, label: 'Devices'),
|
@ -1,4 +1,4 @@
|
||||
part of 'spaces_cubit.dart';
|
||||
part of 'home_cubit.dart';
|
||||
|
||||
abstract class SpacesState {}
|
||||
|
@ -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,
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_svg/flutter_svg.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/shared_widgets/text_widgets/body_medium.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
@ -15,9 +15,9 @@ class AppBarHomeDropdown extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<SpacesCubit, SpacesState>(
|
||||
return BlocBuilder<HomeCubit, SpacesState>(
|
||||
builder: (context, state) {
|
||||
return SpacesCubit.selectedSpace == null
|
||||
return HomeCubit.selectedSpace == null
|
||||
? const Center(child: BodyMedium(text: 'No Home Selected'))
|
||||
: Padding(
|
||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||
@ -30,8 +30,8 @@ class AppBarHomeDropdown extends StatelessWidget {
|
||||
underline: const SizedBox.shrink(),
|
||||
padding: const EdgeInsets.all(0),
|
||||
borderRadius: BorderRadius.circular(20),
|
||||
value: SpacesCubit.selectedSpace!.id,
|
||||
items: SpacesCubit.spaces!.map((space) {
|
||||
value: HomeCubit.selectedSpace!.id,
|
||||
items: HomeCubit.spaces!.map((space) {
|
||||
return DropdownMenuItem(
|
||||
value: space.id,
|
||||
child: SizedBox(
|
||||
@ -67,7 +67,7 @@ class AppBarHomeDropdown extends StatelessWidget {
|
||||
}).toList(),
|
||||
onChanged: (value) {
|
||||
if (value != null) {
|
||||
SpacesCubit.get(context).selectSpace(SpacesCubit.spaces!
|
||||
HomeCubit.get(context).selectSpace(HomeCubit.spaces!
|
||||
.firstWhere((element) => element.id == value));
|
||||
}
|
||||
},
|
||||
|
@ -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());
|
||||
},
|
||||
),
|
||||
|
@ -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],
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -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,
|
||||
),
|
||||
);
|
||||
},
|
||||
|
@ -3,7 +3,7 @@ import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:flutter_secure_storage/flutter_secure_storage.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/auth/model/login_with_email_model.dart';
|
||||
import 'package:syncrow_app/features/auth/model/token.dart';
|
||||
@ -42,8 +42,6 @@ class AuthCubit extends Cubit<AuthState> {
|
||||
|
||||
static Token token = Token.emptyConstructor();
|
||||
|
||||
// (FlutterSecureStorage().read(key :'token'));
|
||||
|
||||
login() async {
|
||||
emit(AuthLoading());
|
||||
try {
|
||||
@ -76,7 +74,7 @@ class AuthCubit extends Cubit<AuthState> {
|
||||
try {
|
||||
FlutterSecureStorage storage = const FlutterSecureStorage();
|
||||
await storage.delete(key: Token.loginAccessTokenKey);
|
||||
SpacesCubit.clear();
|
||||
HomeCubit.clear();
|
||||
emit(AuthLoggedOut());
|
||||
} on DioException catch (e) {
|
||||
emit(AuthError(ServerFailure.fromDioError(e).errMessage));
|
||||
|
@ -3,7 +3,7 @@
|
||||
import 'package:dio/dio.dart';
|
||||
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/app_layout/model/space_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_category_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/device_control_model.dart';
|
||||
@ -22,8 +22,8 @@ part 'devices_state.dart';
|
||||
|
||||
class DevicesCubit extends Cubit<DevicesState> {
|
||||
DevicesCubit() : super(DevicesInitial()) {
|
||||
if (SpacesCubit.selectedSpace != null) {
|
||||
fetchGroups(SpacesCubit.selectedSpace!.id!);
|
||||
if (HomeCubit.selectedSpace != null) {
|
||||
fetchGroups(HomeCubit.selectedSpace!.id!);
|
||||
}
|
||||
}
|
||||
bool _isClosed = false;
|
||||
|
@ -43,7 +43,7 @@ class ACsList extends StatelessWidget {
|
||||
itemBuilder: (context, index) {
|
||||
DeviceModel ac = DevicesCubit.get(context)
|
||||
.chosenCategory!
|
||||
.devices![index] as DeviceModel;
|
||||
.devices![index];
|
||||
return Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
|
@ -1,7 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||
import 'package:smooth_page_indicator/smooth_page_indicator.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/view/widgets/devices_view_header.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/room_page.dart';
|
||||
import 'package:syncrow_app/features/devices/view/widgets/rooms_slider.dart';
|
||||
@ -18,7 +18,7 @@ class DevicesViewBody extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<SpacesCubit, SpacesState>(
|
||||
return BlocBuilder<HomeCubit, SpacesState>(
|
||||
builder: (context, state) {
|
||||
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||
builder: (context, state) {
|
||||
@ -42,15 +42,15 @@ class DevicesViewBody extends StatelessWidget {
|
||||
Expanded(
|
||||
child: PageView(
|
||||
controller:
|
||||
SpacesCubit.get(context).devicesPageController,
|
||||
HomeCubit.get(context).devicesPageController,
|
||||
onPageChanged: (index) {
|
||||
SpacesCubit.get(context).devicesPageChanged(index);
|
||||
HomeCubit.get(context).devicesPageChanged(index);
|
||||
},
|
||||
children: [
|
||||
const WizardPage(),
|
||||
if (SpacesCubit.selectedSpace != null)
|
||||
if (SpacesCubit.selectedSpace!.rooms != null)
|
||||
...SpacesCubit.selectedSpace!.rooms!.map(
|
||||
if (HomeCubit.selectedSpace != null)
|
||||
if (HomeCubit.selectedSpace!.rooms != null)
|
||||
...HomeCubit.selectedSpace!.rooms!.map(
|
||||
(room) {
|
||||
return RoomPage(
|
||||
room: room,
|
||||
@ -60,16 +60,15 @@ class DevicesViewBody extends StatelessWidget {
|
||||
],
|
||||
),
|
||||
),
|
||||
SpacesCubit.selectedSpace != null
|
||||
HomeCubit.selectedSpace != null
|
||||
? Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
vertical: 7,
|
||||
),
|
||||
child: SmoothPageIndicator(
|
||||
controller: SpacesCubit.get(context)
|
||||
.devicesPageController,
|
||||
count:
|
||||
SpacesCubit.selectedSpace!.rooms!.length + 1,
|
||||
controller:
|
||||
HomeCubit.get(context).devicesPageController,
|
||||
count: HomeCubit.selectedSpace!.rooms!.length + 1,
|
||||
effect: const WormEffect(
|
||||
paintStyle: PaintingStyle.stroke,
|
||||
dotHeight: 8,
|
||||
|
@ -41,8 +41,8 @@ class LightInterfaceRecentColor extends StatelessWidget {
|
||||
margin: const EdgeInsets.only(right: 10),
|
||||
width: 40,
|
||||
height: 40,
|
||||
decoration: ShapeDecoration(
|
||||
shape: const CircleBorder(),
|
||||
decoration: const ShapeDecoration(
|
||||
shape: CircleBorder(),
|
||||
// color: Color(light.recentColors[index]),
|
||||
),
|
||||
),
|
||||
|
@ -1,7 +1,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/devices/model/device_model.dart';
|
||||
import 'package:syncrow_app/features/devices/model/function_model.dart';
|
||||
@ -27,7 +27,7 @@ class LightSwitchesView extends StatelessWidget {
|
||||
extendBodyBehindAppBar: true,
|
||||
extendBody: true,
|
||||
appBar: const CategoryViewAppBar(),
|
||||
body: BlocBuilder<SpacesCubit, SpacesState>(
|
||||
body: BlocBuilder<HomeCubit, SpacesState>(
|
||||
builder: (context, state) {
|
||||
return Container(
|
||||
width: MediaQuery.sizeOf(context).width,
|
||||
|
@ -1,6 +1,6 @@
|
||||
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/shared_widgets/text_widgets/title_medium.dart';
|
||||
import 'package:syncrow_app/utils/context_extension.dart';
|
||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||
@ -13,48 +13,48 @@ class RoomsSlider extends StatelessWidget {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return BlocBuilder<SpacesCubit, SpacesState>(
|
||||
return BlocBuilder<HomeCubit, SpacesState>(
|
||||
builder: (context, state) {
|
||||
return SizedBox(
|
||||
height: 40,
|
||||
child: PageView(
|
||||
controller: SpacesCubit.get(context).roomsPageController,
|
||||
controller: HomeCubit.get(context).roomsPageController,
|
||||
onPageChanged: (index) {
|
||||
SpacesCubit.get(context).roomSliderPageChanged(index);
|
||||
HomeCubit.get(context).roomSliderPageChanged(index);
|
||||
},
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
SpacesCubit.get(context).unselectRoom();
|
||||
HomeCubit.get(context).unselectRoom();
|
||||
},
|
||||
child: TitleMedium(
|
||||
text: StringsManager.wizard,
|
||||
style: context.titleMedium.copyWith(
|
||||
fontSize: 25,
|
||||
color: SpacesCubit.get(context).selectedRoom == null
|
||||
color: HomeCubit.get(context).selectedRoom == null
|
||||
? ColorsManager.textPrimaryColor
|
||||
: ColorsManager.textPrimaryColor.withOpacity(.2),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (SpacesCubit.selectedSpace != null)
|
||||
if (SpacesCubit.selectedSpace!.rooms != null)
|
||||
...SpacesCubit.selectedSpace!.rooms!.map(
|
||||
if (HomeCubit.selectedSpace != null)
|
||||
if (HomeCubit.selectedSpace!.rooms != null)
|
||||
...HomeCubit.selectedSpace!.rooms!.map(
|
||||
(room) => Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 15),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
SpacesCubit.get(context).roomSliderPageChanged(
|
||||
SpacesCubit.selectedSpace!.rooms!.indexOf(room));
|
||||
HomeCubit.get(context).roomSliderPageChanged(
|
||||
HomeCubit.selectedSpace!.rooms!.indexOf(room));
|
||||
},
|
||||
child: TitleMedium(
|
||||
text: room.name!,
|
||||
style: context.titleMedium.copyWith(
|
||||
fontSize: 25,
|
||||
color: SpacesCubit.get(context).selectedRoom == room
|
||||
color: HomeCubit.get(context).selectedRoom == room
|
||||
? ColorsManager.textPrimaryColor
|
||||
: ColorsManager.textPrimaryColor
|
||||
.withOpacity(.2),
|
||||
|
@ -15,9 +15,8 @@ class SplashView extends StatelessWidget {
|
||||
return BlocConsumer<AuthCubit, AuthState>(
|
||||
listener: (context, state) {
|
||||
if (state is AuthTokenSuccess) {
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
Navigator.pushReplacementNamed(context, Routes.homeRoute);
|
||||
});
|
||||
Navigator.pushNamedAndRemoveUntil(
|
||||
context, Routes.homeRoute, (route) => false);
|
||||
} else if (state is AuthTokenError) {
|
||||
Future.delayed(const Duration(seconds: 1), () {
|
||||
Navigator.pushReplacement(
|
||||
|
Reference in New Issue
Block a user