Refactor device-related views and add error handling

Refactor device-related views to improve code structure and readability.
Add error handling for authentication token in the splash view.
Remove unnecessary NavCubit from the app initialization.
This commit is contained in:
Mohammad Salameh
2024-03-21 13:58:20 +03:00
parent 96d5f53d38
commit c0bfd24751
20 changed files with 607 additions and 625 deletions

View File

@ -1,6 +1,6 @@
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:syncrow_app/features/app_layout/bloc/nav_cubit.dart';
import 'package:syncrow_app/features/app_layout/bloc/spaces_cubit.dart';
import 'package:syncrow_app/features/devices/bloc/devices_cubit.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
@ -13,9 +13,9 @@ class DefaultNavBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return BlocBuilder<NavCubit, NavState>(
return BlocBuilder<SpacesCubit, SpacesState>(
builder: (context, state) {
var cubit = NavCubit.of(context);
var cubit = SpacesCubit.get(context);
return SizedBox(
height: Constants.bottomNavBarHeight,
child: BottomNavigationBar(
@ -29,7 +29,7 @@ class DefaultNavBar extends StatelessWidget {
SpacesCubit.get(context).unselectRoom();
}
},
currentIndex: NavCubit.pageIndex,
currentIndex: SpacesCubit.pageIndex,
selectedItemColor: ColorsManager.primaryColor,
selectedLabelStyle: const TextStyle(
color: ColorsManager.primaryColor,