mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-17 02:25:16 +00:00
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:
@ -1,167 +0,0 @@
|
|||||||
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/view/widgets/app_bar_home_dropdown.dart';
|
|
||||||
import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart';
|
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart';
|
|
||||||
import 'package:syncrow_app/features/menu/view/menu_view.dart';
|
|
||||||
import 'package:syncrow_app/features/scene/view/scene_view.dart';
|
|
||||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
||||||
|
|
||||||
import '../../../generated/assets.dart';
|
|
||||||
|
|
||||||
part 'nav_state.dart';
|
|
||||||
|
|
||||||
class NavCubit extends Cubit<NavState> {
|
|
||||||
NavCubit() : super(NavInitial());
|
|
||||||
|
|
||||||
static NavCubit of(context) => BlocProvider.of<NavCubit>(context);
|
|
||||||
|
|
||||||
static clear() {
|
|
||||||
pageIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int pageIndex = 0;
|
|
||||||
|
|
||||||
static Map<String, List<Widget>> appBarActions = {
|
|
||||||
'Dashboard': [
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.add,
|
|
||||||
size: 25,
|
|
||||||
),
|
|
||||||
style: ButtonStyle(
|
|
||||||
foregroundColor:
|
|
||||||
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
|
|
||||||
),
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
'Devices': [
|
|
||||||
// IconButton(
|
|
||||||
// icon: Image.asset(
|
|
||||||
// Assets.iconsFilter,
|
|
||||||
// height: 20,
|
|
||||||
// width: 20,
|
|
||||||
// ),
|
|
||||||
// onPressed: () {},
|
|
||||||
// ),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.add,
|
|
||||||
size: 25,
|
|
||||||
),
|
|
||||||
style: ButtonStyle(
|
|
||||||
foregroundColor:
|
|
||||||
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
|
|
||||||
),
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.more_vert,
|
|
||||||
size: 25,
|
|
||||||
),
|
|
||||||
style: ButtonStyle(
|
|
||||||
foregroundColor:
|
|
||||||
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
|
|
||||||
),
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
'Routine': [
|
|
||||||
// IconButton(
|
|
||||||
// icon: Image.asset(
|
|
||||||
// Assets.iconsFilter,
|
|
||||||
// height: 20,
|
|
||||||
// width: 20,
|
|
||||||
// ),
|
|
||||||
// onPressed: () {},
|
|
||||||
// ),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.add,
|
|
||||||
size: 25,
|
|
||||||
),
|
|
||||||
style: ButtonStyle(
|
|
||||||
foregroundColor:
|
|
||||||
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
|
|
||||||
),
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
icon: const Icon(
|
|
||||||
Icons.more_vert,
|
|
||||||
size: 25,
|
|
||||||
),
|
|
||||||
style: ButtonStyle(
|
|
||||||
foregroundColor:
|
|
||||||
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
|
|
||||||
),
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
'Menu': [
|
|
||||||
IconButton(
|
|
||||||
icon: SvgPicture.asset(
|
|
||||||
Assets.iconsScan,
|
|
||||||
height: 20,
|
|
||||||
width: 20,
|
|
||||||
),
|
|
||||||
onPressed: () {},
|
|
||||||
),
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
static Map<String, Widget?> appBarLeading = {
|
|
||||||
'Dashboard': const AppBarHomeDropdown(),
|
|
||||||
'Devices': const AppBarHomeDropdown(),
|
|
||||||
'Routine': const AppBarHomeDropdown(),
|
|
||||||
'Menu': Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 15),
|
|
||||||
child: Image.asset(
|
|
||||||
Assets.imagesLogoHorizontal,
|
|
||||||
height: 15,
|
|
||||||
width: 100,
|
|
||||||
fit: BoxFit.scaleDown,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
var bottomNavItems = [
|
|
||||||
defaultBottomNavBarItem(icon: Assets.iconsDashboard, label: 'Dashboard'),
|
|
||||||
// defaultBottomNavBarItem(icon: Assets.iconslayout, label: 'Layout'),
|
|
||||||
defaultBottomNavBarItem(icon: Assets.iconsDevices, label: 'Devices'),
|
|
||||||
defaultBottomNavBarItem(icon: Assets.iconsRoutines, label: 'Routine'),
|
|
||||||
defaultBottomNavBarItem(icon: Assets.iconsMenu, label: 'Menu'),
|
|
||||||
];
|
|
||||||
|
|
||||||
final List<Widget> pages = [
|
|
||||||
const DashboardView(),
|
|
||||||
// const LayoutPage(),
|
|
||||||
const DevicesViewBody(),
|
|
||||||
const SceneView(),
|
|
||||||
const MenuView(),
|
|
||||||
];
|
|
||||||
|
|
||||||
void updatePageIndex(int index) {
|
|
||||||
pageIndex = index;
|
|
||||||
|
|
||||||
emit(NavChangePage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BottomNavigationBarItem defaultBottomNavBarItem(
|
|
||||||
{required String icon, required String label}) {
|
|
||||||
return BottomNavigationBarItem(
|
|
||||||
icon: SvgPicture.asset(icon),
|
|
||||||
activeIcon: SvgPicture.asset(
|
|
||||||
icon.replaceAll('.svg', '-fill.svg'),
|
|
||||||
colorFilter: const ColorFilter.mode(
|
|
||||||
ColorsManager.primaryColor,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
label: label,
|
|
||||||
);
|
|
||||||
}
|
|
@ -1,7 +0,0 @@
|
|||||||
part of 'nav_cubit.dart';
|
|
||||||
|
|
||||||
abstract class NavState {}
|
|
||||||
|
|
||||||
class NavInitial extends NavState {}
|
|
||||||
|
|
||||||
class NavChangePage extends NavState {}
|
|
@ -1,27 +1,42 @@
|
|||||||
import 'package:dio/dio.dart';
|
import 'package:dio/dio.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
import 'package:syncrow_app/features/app_layout/model/space_model.dart';
|
||||||
|
import 'package:syncrow_app/features/app_layout/view/widgets/app_bar_home_dropdown.dart';
|
||||||
|
import 'package:syncrow_app/features/dashboard/view/dashboard_view.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/room_model.dart';
|
import 'package:syncrow_app/features/devices/model/room_model.dart';
|
||||||
|
import 'package:syncrow_app/features/devices/view/widgets/devices_view_body.dart';
|
||||||
|
import 'package:syncrow_app/features/menu/view/menu_view.dart';
|
||||||
|
import 'package:syncrow_app/features/scene/view/scene_view.dart';
|
||||||
|
import 'package:syncrow_app/generated/assets.dart';
|
||||||
import 'package:syncrow_app/services/api/network_exception.dart';
|
import 'package:syncrow_app/services/api/network_exception.dart';
|
||||||
import 'package:syncrow_app/services/api/spaces_api.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 'spaces_state.dart';
|
||||||
|
|
||||||
class SpacesCubit extends Cubit<SpacesState> {
|
class SpacesCubit extends Cubit<SpacesState> {
|
||||||
SpacesCubit() : super(SpacesInitial()) {
|
SpacesCubit() : super(SpacesInitial()) {
|
||||||
fetchSpaces().then((value) {
|
if (SpacesCubit.spaces != null) {
|
||||||
if (selectedSpace != null) {
|
if (selectedSpace == null) {
|
||||||
fetchRooms(selectedSpace!);
|
fetchSpaces().then((value) {
|
||||||
|
if (selectedSpace != null) {
|
||||||
|
print('selectedSpace: ${selectedSpace!.name}');
|
||||||
|
fetchRooms(selectedSpace!);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
} else {
|
||||||
|
fetchSpaces(); // this is for the first time
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static SpacesCubit get(context) => BlocProvider.of(context);
|
static SpacesCubit get(context) => BlocProvider.of(context);
|
||||||
|
|
||||||
static List<SpaceModel> spaces = [];
|
static List<SpaceModel>? spaces;
|
||||||
|
|
||||||
static SpaceModel? selectedSpace = spaces.isNotEmpty ? spaces.first : null;
|
static SpaceModel? selectedSpace;
|
||||||
|
|
||||||
RoomModel? selectedRoom;
|
RoomModel? selectedRoom;
|
||||||
|
|
||||||
@ -33,7 +48,7 @@ class SpacesCubit extends Cubit<SpacesState> {
|
|||||||
|
|
||||||
selectSpace(SpaceModel space) {
|
selectSpace(SpaceModel space) {
|
||||||
selectedSpace = space;
|
selectedSpace = space;
|
||||||
emit(SpacesSelected(space));
|
emit(SpaceSelected(space));
|
||||||
}
|
}
|
||||||
|
|
||||||
roomSliderPageChanged(int index) {
|
roomSliderPageChanged(int index) {
|
||||||
@ -84,27 +99,177 @@ class SpacesCubit extends Cubit<SpacesState> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fetchSpaces() async {
|
fetchSpaces() async {
|
||||||
emit(SpacesLoading());
|
emit(GetSpacesLoading());
|
||||||
try {
|
try {
|
||||||
spaces = await SpacesAPI.getSpaces();
|
spaces = await SpacesAPI.getSpaces();
|
||||||
spaces.isNotEmpty ? selectSpace(spaces.first) : null;
|
selectedSpace = spaces!.isNotEmpty ? selectSpace(spaces!.first) : null;
|
||||||
emit(SpacesLoaded(spaces));
|
emit(GetSpacesLoaded(spaces!));
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
emit(SpacesError(ServerFailure.fromDioError(e).errMessage));
|
emit(GetSpacesError(ServerFailure.fromDioError(e).errMessage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetchRooms(SpaceModel space) async {
|
fetchRooms(SpaceModel space) async {
|
||||||
emit(SpaceRoomsLoading());
|
emit(GetSpaceRoomsLoading());
|
||||||
try {
|
try {
|
||||||
space.rooms = await SpacesAPI.getRooms(space.id!);
|
space.rooms = await SpacesAPI.getRooms(space.id!);
|
||||||
if (space.rooms != null) {
|
if (space.rooms != null) {
|
||||||
emit(SpaceRoomsLoaded(space.rooms!));
|
emit(GetSpaceRoomsLoaded(space.rooms!));
|
||||||
} else {
|
} else {
|
||||||
emit(SpaceRoomsError("No rooms found"));
|
emit(GetSpaceRoomsError("No rooms found"));
|
||||||
}
|
}
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
emit(SpacesError(ServerFailure.fromDioError(e).errMessage));
|
emit(GetSpacesError(ServerFailure.fromDioError(e).errMessage));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////Nav////////////////////////////////////////
|
||||||
|
|
||||||
|
static clear() {
|
||||||
|
pageIndex = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int pageIndex = 0;
|
||||||
|
|
||||||
|
static Map<String, List<Widget>> appBarActions = {
|
||||||
|
'Dashboard': [
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.add,
|
||||||
|
size: 25,
|
||||||
|
),
|
||||||
|
style: ButtonStyle(
|
||||||
|
foregroundColor:
|
||||||
|
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
|
||||||
|
),
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
'Devices': [
|
||||||
|
// IconButton(
|
||||||
|
// icon: Image.asset(
|
||||||
|
// Assets.iconsFilter,
|
||||||
|
// height: 20,
|
||||||
|
// width: 20,
|
||||||
|
// ),
|
||||||
|
// onPressed: () {},
|
||||||
|
// ),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.add,
|
||||||
|
size: 25,
|
||||||
|
),
|
||||||
|
style: ButtonStyle(
|
||||||
|
foregroundColor:
|
||||||
|
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
|
||||||
|
),
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
size: 25,
|
||||||
|
),
|
||||||
|
style: ButtonStyle(
|
||||||
|
foregroundColor:
|
||||||
|
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
|
||||||
|
),
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
'Routine': [
|
||||||
|
// IconButton(
|
||||||
|
// icon: Image.asset(
|
||||||
|
// Assets.iconsFilter,
|
||||||
|
// height: 20,
|
||||||
|
// width: 20,
|
||||||
|
// ),
|
||||||
|
// onPressed: () {},
|
||||||
|
// ),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.add,
|
||||||
|
size: 25,
|
||||||
|
),
|
||||||
|
style: ButtonStyle(
|
||||||
|
foregroundColor:
|
||||||
|
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
|
||||||
|
),
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
IconButton(
|
||||||
|
icon: const Icon(
|
||||||
|
Icons.more_vert,
|
||||||
|
size: 25,
|
||||||
|
),
|
||||||
|
style: ButtonStyle(
|
||||||
|
foregroundColor:
|
||||||
|
MaterialStateProperty.all(ColorsManager.textPrimaryColor),
|
||||||
|
),
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
'Menu': [
|
||||||
|
IconButton(
|
||||||
|
icon: SvgPicture.asset(
|
||||||
|
Assets.iconsScan,
|
||||||
|
height: 20,
|
||||||
|
width: 20,
|
||||||
|
),
|
||||||
|
onPressed: () {},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
|
static Map<String, Widget?> appBarLeading = {
|
||||||
|
'Dashboard': const AppBarHomeDropdown(),
|
||||||
|
'Devices': const AppBarHomeDropdown(),
|
||||||
|
'Routine': const AppBarHomeDropdown(),
|
||||||
|
'Menu': Padding(
|
||||||
|
padding: const EdgeInsets.only(left: 15),
|
||||||
|
child: Image.asset(
|
||||||
|
Assets.imagesLogoHorizontal,
|
||||||
|
height: 15,
|
||||||
|
width: 100,
|
||||||
|
fit: BoxFit.scaleDown,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
};
|
||||||
|
|
||||||
|
var bottomNavItems = [
|
||||||
|
defaultBottomNavBarItem(icon: Assets.iconsDashboard, label: 'Dashboard'),
|
||||||
|
// defaultBottomNavBarItem(icon: Assets.iconslayout, label: 'Layout'),
|
||||||
|
defaultBottomNavBarItem(icon: Assets.iconsDevices, label: 'Devices'),
|
||||||
|
defaultBottomNavBarItem(icon: Assets.iconsRoutines, label: 'Routine'),
|
||||||
|
defaultBottomNavBarItem(icon: Assets.iconsMenu, label: 'Menu'),
|
||||||
|
];
|
||||||
|
|
||||||
|
final List<Widget> pages = [
|
||||||
|
const DashboardView(),
|
||||||
|
// const LayoutPage(),
|
||||||
|
const DevicesViewBody(),
|
||||||
|
const SceneView(),
|
||||||
|
const MenuView(),
|
||||||
|
];
|
||||||
|
|
||||||
|
void updatePageIndex(int index) {
|
||||||
|
pageIndex = index;
|
||||||
|
|
||||||
|
emit(NavChangePage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BottomNavigationBarItem defaultBottomNavBarItem(
|
||||||
|
{required String icon, required String label}) {
|
||||||
|
return BottomNavigationBarItem(
|
||||||
|
icon: SvgPicture.asset(icon),
|
||||||
|
activeIcon: SvgPicture.asset(
|
||||||
|
icon.replaceAll('.svg', '-fill.svg'),
|
||||||
|
colorFilter: const ColorFilter.mode(
|
||||||
|
ColorsManager.primaryColor,
|
||||||
|
BlendMode.srcIn,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
label: label,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
@ -4,36 +4,37 @@ abstract class SpacesState {}
|
|||||||
|
|
||||||
class SpacesInitial extends SpacesState {}
|
class SpacesInitial extends SpacesState {}
|
||||||
|
|
||||||
class SpacesLoading extends SpacesState {}
|
class GetSpacesLoading extends SpacesState {}
|
||||||
|
|
||||||
class SpacesLoaded extends SpacesState {
|
class GetSpacesLoaded extends SpacesState {
|
||||||
final List<SpaceModel> spaces;
|
final List<SpaceModel> spaces;
|
||||||
|
|
||||||
SpacesLoaded(this.spaces);
|
GetSpacesLoaded(this.spaces);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpacesError extends SpacesState {
|
class GetSpacesError extends SpacesState {
|
||||||
final String errMessage;
|
final String errMessage;
|
||||||
|
|
||||||
SpacesError(this.errMessage);
|
GetSpacesError(this.errMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpaceRoomsLoading extends SpacesLoading {}
|
class GetSpaceRoomsLoading extends SpacesState {}
|
||||||
|
|
||||||
class SpaceRoomsLoaded extends SpacesLoading {
|
class GetSpaceRoomsLoaded extends SpacesState {
|
||||||
final List<RoomModel> rooms;
|
final List<RoomModel> rooms;
|
||||||
|
|
||||||
SpaceRoomsLoaded(this.rooms);
|
GetSpaceRoomsLoaded(this.rooms);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpaceRoomsError extends SpacesError {
|
class GetSpaceRoomsError extends SpacesState {
|
||||||
SpaceRoomsError(super.errMessage);
|
final String errMessage;
|
||||||
|
GetSpaceRoomsError(this.errMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
class SpacesSelected extends SpacesState {
|
class SpaceSelected extends SpacesState {
|
||||||
final SpaceModel space;
|
final SpaceModel space;
|
||||||
|
|
||||||
SpacesSelected(this.space);
|
SpaceSelected(this.space);
|
||||||
}
|
}
|
||||||
|
|
||||||
class RoomSelected extends SpacesState {
|
class RoomSelected extends SpacesState {
|
||||||
@ -43,3 +44,5 @@ class RoomSelected extends SpacesState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class RoomUnSelected extends SpacesState {}
|
class RoomUnSelected extends SpacesState {}
|
||||||
|
|
||||||
|
class NavChangePage extends SpacesState {}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.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/app_layout/bloc/spaces_cubit.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/view/widgets/app_body.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_app_bar.dart';
|
||||||
@ -26,7 +26,7 @@ class AppLayout extends StatelessWidget {
|
|||||||
],
|
],
|
||||||
child: BlocListener<SpacesCubit, SpacesState>(
|
child: BlocListener<SpacesCubit, SpacesState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is SpacesError) {
|
if (state is GetSpacesError) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(state.errMessage),
|
content: Text(state.errMessage),
|
||||||
@ -36,7 +36,7 @@ class AppLayout extends StatelessWidget {
|
|||||||
.popUntil((route) => route.settings.name == Routes.authLogin);
|
.popUntil((route) => route.settings.name == Routes.authLogin);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: BlocBuilder<NavCubit, NavState>(
|
child: BlocBuilder<SpacesCubit, SpacesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return AnnotatedRegion(
|
return AnnotatedRegion(
|
||||||
value: SystemUiOverlayStyle(
|
value: SystemUiOverlayStyle(
|
||||||
@ -50,15 +50,15 @@ class AppLayout extends StatelessWidget {
|
|||||||
backgroundColor: ColorsManager.backgroundColor,
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar:
|
appBar: state is! GetSpacesLoading ||
|
||||||
state is! SpacesLoading || state is! SpaceRoomsLoading
|
state is! GetSpaceRoomsLoading
|
||||||
? const DefaultAppBar()
|
? const DefaultAppBar()
|
||||||
: null,
|
: null,
|
||||||
body: const AppBody(),
|
body: const AppBody(),
|
||||||
bottomNavigationBar:
|
bottomNavigationBar: state is! GetSpacesLoading ||
|
||||||
state is! SpacesLoading || state is! SpaceRoomsLoading
|
state is! GetSpaceRoomsLoading
|
||||||
? const DefaultNavBar()
|
? const DefaultNavBar()
|
||||||
: null,
|
: null,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -17,60 +17,62 @@ class AppBarHomeDropdown extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<SpacesCubit, SpacesState>(
|
return BlocBuilder<SpacesCubit, SpacesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Padding(
|
return SpacesCubit.selectedSpace == null
|
||||||
padding: const EdgeInsets.only(left: 10, right: 10),
|
? const Center(child: BodyMedium(text: 'No Home Selected'))
|
||||||
child: DropdownButton(
|
: Padding(
|
||||||
icon: const Icon(
|
padding: const EdgeInsets.only(left: 10, right: 10),
|
||||||
Icons.expand_more,
|
child: DropdownButton(
|
||||||
color: Colors.black,
|
icon: const Icon(
|
||||||
size: 25,
|
Icons.expand_more,
|
||||||
),
|
color: Colors.black,
|
||||||
underline: const SizedBox.shrink(),
|
size: 25,
|
||||||
padding: const EdgeInsets.all(0),
|
|
||||||
borderRadius: BorderRadius.circular(20),
|
|
||||||
value: SpacesCubit.selectedSpace!.id,
|
|
||||||
items: SpacesCubit.spaces.map((space) {
|
|
||||||
return DropdownMenuItem(
|
|
||||||
value: space.id,
|
|
||||||
child: SizedBox(
|
|
||||||
width: 100,
|
|
||||||
child: Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: <Widget>[
|
|
||||||
SvgPicture.asset(
|
|
||||||
Assets.iconsHome,
|
|
||||||
width: 25,
|
|
||||||
height: 25,
|
|
||||||
colorFilter: const ColorFilter.mode(
|
|
||||||
ColorsManager.textPrimaryColor,
|
|
||||||
BlendMode.srcIn,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
const SizedBox(width: 5),
|
|
||||||
Expanded(
|
|
||||||
child: BodyMedium(
|
|
||||||
text: space.name ?? "??",
|
|
||||||
style: context.bodyMedium.copyWith(
|
|
||||||
fontSize: 15,
|
|
||||||
color: ColorsManager.textPrimaryColor,
|
|
||||||
overflow: TextOverflow.ellipsis,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
|
underline: const SizedBox.shrink(),
|
||||||
|
padding: const EdgeInsets.all(0),
|
||||||
|
borderRadius: BorderRadius.circular(20),
|
||||||
|
value: SpacesCubit.selectedSpace!.id,
|
||||||
|
items: SpacesCubit.spaces!.map((space) {
|
||||||
|
return DropdownMenuItem(
|
||||||
|
value: space.id,
|
||||||
|
child: SizedBox(
|
||||||
|
width: 100,
|
||||||
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
SvgPicture.asset(
|
||||||
|
Assets.iconsHome,
|
||||||
|
width: 25,
|
||||||
|
height: 25,
|
||||||
|
colorFilter: const ColorFilter.mode(
|
||||||
|
ColorsManager.textPrimaryColor,
|
||||||
|
BlendMode.srcIn,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 5),
|
||||||
|
Expanded(
|
||||||
|
child: BodyMedium(
|
||||||
|
text: space.name ?? "??",
|
||||||
|
style: context.bodyMedium.copyWith(
|
||||||
|
fontSize: 15,
|
||||||
|
color: ColorsManager.textPrimaryColor,
|
||||||
|
overflow: TextOverflow.ellipsis,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}).toList(),
|
||||||
|
onChanged: (value) {
|
||||||
|
if (value != null) {
|
||||||
|
SpacesCubit.get(context).selectSpace(SpacesCubit.spaces!
|
||||||
|
.firstWhere((element) => element.id == value));
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}).toList(),
|
|
||||||
onChanged: (value) {
|
|
||||||
if (value != null) {
|
|
||||||
SpacesCubit.get(context).selectSpace(SpacesCubit.spaces
|
|
||||||
.firstWhere((element) => element.id == value));
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.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/app_layout/bloc/spaces_cubit.dart';
|
||||||
|
|
||||||
import '../../../../generated/assets.dart';
|
import '../../../../generated/assets.dart';
|
||||||
@ -12,7 +12,7 @@ class AppBody extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<NavCubit, NavState>(
|
return BlocBuilder<SpacesCubit, SpacesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
@ -28,7 +28,7 @@ class AppBody extends StatelessWidget {
|
|||||||
),
|
),
|
||||||
child: BlocConsumer<SpacesCubit, SpacesState>(
|
child: BlocConsumer<SpacesCubit, SpacesState>(
|
||||||
listener: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is SpacesError) {
|
if (state is GetSpacesError) {
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
ScaffoldMessenger.of(context).showSnackBar(
|
||||||
SnackBar(
|
SnackBar(
|
||||||
content: Text(state.errMessage),
|
content: Text(state.errMessage),
|
||||||
@ -37,8 +37,9 @@ class AppBody extends StatelessWidget {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return state is! SpacesLoading || state is! SpaceRoomsLoading
|
return state is! GetSpacesLoading ||
|
||||||
? NavCubit.of(context).pages[NavCubit.pageIndex]
|
state is! GetSpaceRoomsLoading
|
||||||
|
? SpacesCubit.get(context).pages[SpacesCubit.pageIndex]
|
||||||
: const Center(child: CircularProgressIndicator());
|
: const Center(child: CircularProgressIndicator());
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.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/app_layout/bloc/spaces_cubit.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
|
|
||||||
@ -9,27 +9,26 @@ class DefaultAppBar extends StatelessWidget implements PreferredSizeWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<NavCubit, NavState>(
|
return BlocBuilder<SpacesCubit, SpacesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return BlocBuilder<SpacesCubit, SpacesState>(
|
return Padding(
|
||||||
builder: (context, state) {
|
padding: const EdgeInsets.only(
|
||||||
return Padding(
|
top: 20,
|
||||||
padding: const EdgeInsets.only(
|
),
|
||||||
top: 20,
|
child: AppBar(
|
||||||
),
|
backgroundColor: Colors.transparent,
|
||||||
child: AppBar(
|
leadingWidth: 150,
|
||||||
backgroundColor: Colors.transparent,
|
toolbarHeight: Constants.appBarHeight,
|
||||||
leadingWidth: 150,
|
leading: SpacesCubit.spaces != null
|
||||||
toolbarHeight: Constants.appBarHeight,
|
? SpacesCubit.spaces!.isNotEmpty
|
||||||
leading: SpacesCubit.spaces.isNotEmpty
|
? SpacesCubit.appBarLeading[SpacesCubit()
|
||||||
? NavCubit.appBarLeading[
|
.bottomNavItems[SpacesCubit.pageIndex]
|
||||||
NavCubit().bottomNavItems[NavCubit.pageIndex].label]
|
.label]
|
||||||
: null,
|
: null
|
||||||
actions: NavCubit.appBarActions[
|
: null,
|
||||||
NavCubit().bottomNavItems[NavCubit.pageIndex].label],
|
actions: SpacesCubit.appBarActions[
|
||||||
),
|
SpacesCubit().bottomNavItems[SpacesCubit.pageIndex].label],
|
||||||
);
|
),
|
||||||
},
|
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.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/app_layout/bloc/spaces_cubit.dart';
|
||||||
import 'package:syncrow_app/features/devices/bloc/devices_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/color_manager.dart';
|
||||||
@ -13,9 +13,9 @@ class DefaultNavBar extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<NavCubit, NavState>(
|
return BlocBuilder<SpacesCubit, SpacesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
var cubit = NavCubit.of(context);
|
var cubit = SpacesCubit.get(context);
|
||||||
return SizedBox(
|
return SizedBox(
|
||||||
height: Constants.bottomNavBarHeight,
|
height: Constants.bottomNavBarHeight,
|
||||||
child: BottomNavigationBar(
|
child: BottomNavigationBar(
|
||||||
@ -29,7 +29,7 @@ class DefaultNavBar extends StatelessWidget {
|
|||||||
SpacesCubit.get(context).unselectRoom();
|
SpacesCubit.get(context).unselectRoom();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
currentIndex: NavCubit.pageIndex,
|
currentIndex: SpacesCubit.pageIndex,
|
||||||
selectedItemColor: ColorsManager.primaryColor,
|
selectedItemColor: ColorsManager.primaryColor,
|
||||||
selectedLabelStyle: const TextStyle(
|
selectedLabelStyle: const TextStyle(
|
||||||
color: ColorsManager.primaryColor,
|
color: ColorsManager.primaryColor,
|
||||||
|
@ -3,7 +3,8 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
|
import 'package:flutter_secure_storage/flutter_secure_storage.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/auth/model/login_with_email_model.dart';
|
import 'package:syncrow_app/features/auth/model/login_with_email_model.dart';
|
||||||
import 'package:syncrow_app/features/auth/model/token.dart';
|
import 'package:syncrow_app/features/auth/model/token.dart';
|
||||||
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
import 'package:syncrow_app/features/auth/model/user_model.dart';
|
||||||
@ -75,7 +76,7 @@ class AuthCubit extends Cubit<AuthState> {
|
|||||||
try {
|
try {
|
||||||
FlutterSecureStorage storage = const FlutterSecureStorage();
|
FlutterSecureStorage storage = const FlutterSecureStorage();
|
||||||
await storage.delete(key: Token.loginAccessTokenKey);
|
await storage.delete(key: Token.loginAccessTokenKey);
|
||||||
NavCubit.clear();
|
SpacesCubit.clear();
|
||||||
emit(AuthLoggedOut());
|
emit(AuthLoggedOut());
|
||||||
} on DioException catch (e) {
|
} on DioException catch (e) {
|
||||||
emit(AuthError(ServerFailure.fromDioError(e).errMessage));
|
emit(AuthError(ServerFailure.fromDioError(e).errMessage));
|
||||||
|
@ -22,7 +22,9 @@ part 'devices_state.dart';
|
|||||||
|
|
||||||
class DevicesCubit extends Cubit<DevicesState> {
|
class DevicesCubit extends Cubit<DevicesState> {
|
||||||
DevicesCubit() : super(DevicesInitial()) {
|
DevicesCubit() : super(DevicesInitial()) {
|
||||||
fetchGroups(SpacesCubit.selectedSpace!.id!);
|
if (SpacesCubit.selectedSpace != null) {
|
||||||
|
fetchGroups(SpacesCubit.selectedSpace!.id!);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
bool _isClosed = false;
|
bool _isClosed = false;
|
||||||
|
|
||||||
|
@ -8,15 +8,12 @@ class DevicesView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
create: (context) => DevicesCubit(),
|
builder: (context, state) => Container(
|
||||||
child: BlocBuilder<DevicesCubit, DevicesState>(
|
padding: const EdgeInsets.all(8),
|
||||||
builder: (context, state) => Container(
|
width: MediaQuery.sizeOf(context).width,
|
||||||
padding: const EdgeInsets.all(8),
|
height: MediaQuery.sizeOf(context).height,
|
||||||
width: MediaQuery.sizeOf(context).width,
|
child: const DevicesViewBody(),
|
||||||
height: MediaQuery.sizeOf(context).height,
|
|
||||||
child: const DevicesViewBody(),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -22,130 +22,127 @@ class AcInterfaceTempUnit extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
create: (context) => DevicesCubit(),
|
builder: (context, state) {
|
||||||
child: BlocBuilder<DevicesCubit, DevicesState>(
|
return DefaultContainer(
|
||||||
builder: (context, state) {
|
child: Column(
|
||||||
return DefaultContainer(
|
children: [
|
||||||
child: Column(
|
Expanded(
|
||||||
children: [
|
flex: 8,
|
||||||
Expanded(
|
child: SizedBox(
|
||||||
flex: 8,
|
width: 300,
|
||||||
child: SizedBox(
|
child: SleekCircularSlider(
|
||||||
width: 300,
|
appearance: CircularSliderAppearance(
|
||||||
child: SleekCircularSlider(
|
customWidths: CustomSliderWidths(
|
||||||
appearance: CircularSliderAppearance(
|
progressBarWidth: 15,
|
||||||
customWidths: CustomSliderWidths(
|
trackWidth: 15,
|
||||||
progressBarWidth: 15,
|
shadowWidth: 0,
|
||||||
trackWidth: 15,
|
),
|
||||||
shadowWidth: 0,
|
customColors: CustomSliderColors(
|
||||||
|
progressBarColor:
|
||||||
|
ColorsManager.primaryColor.withOpacity(.6),
|
||||||
|
trackColor: ColorsManager.greyColor,
|
||||||
|
dotColor: Colors.transparent,
|
||||||
|
),
|
||||||
|
infoProperties: InfoProperties(
|
||||||
|
//TODO: move to strings manager
|
||||||
|
bottomLabelText: 'CURRENT TEMP',
|
||||||
|
bottomLabelStyle: context.bodyLarge.copyWith(
|
||||||
|
color: Colors.grey,
|
||||||
|
fontWeight: FontsManager.regular,
|
||||||
),
|
),
|
||||||
customColors: CustomSliderColors(
|
modifier: (double value) {
|
||||||
progressBarColor:
|
// return '${DeviceModel.temperature.toStringAsFixed(1)}°C';
|
||||||
ColorsManager.primaryColor.withOpacity(.6),
|
return '${value.toStringAsFixed(1)}°C';
|
||||||
trackColor: ColorsManager.greyColor,
|
},
|
||||||
dotColor: Colors.transparent,
|
mainLabelStyle: context.titleLarge.copyWith(
|
||||||
),
|
height: 0,
|
||||||
infoProperties: InfoProperties(
|
letterSpacing: -3,
|
||||||
//TODO: move to strings manager
|
color: Colors.black,
|
||||||
bottomLabelText: 'CURRENT TEMP',
|
fontSize: 60,
|
||||||
bottomLabelStyle: context.bodyLarge.copyWith(
|
shadows: [
|
||||||
color: Colors.grey,
|
Shadow(
|
||||||
fontWeight: FontsManager.regular,
|
color: Colors.black.withOpacity(0.5),
|
||||||
),
|
offset: const Offset(0, 3),
|
||||||
modifier: (double value) {
|
blurRadius: 6,
|
||||||
// return '${DeviceModel.temperature.toStringAsFixed(1)}°C';
|
),
|
||||||
return '${value.toStringAsFixed(1)}°C';
|
],
|
||||||
},
|
|
||||||
mainLabelStyle: context.titleLarge.copyWith(
|
|
||||||
height: 0,
|
|
||||||
letterSpacing: -3,
|
|
||||||
color: Colors.black,
|
|
||||||
fontSize: 60,
|
|
||||||
shadows: [
|
|
||||||
Shadow(
|
|
||||||
color: Colors.black.withOpacity(0.5),
|
|
||||||
offset: const Offset(0, 3),
|
|
||||||
blurRadius: 6,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
// min: DeviceModel.bounds.min,
|
|
||||||
// max: DeviceModel.bounds.max,
|
|
||||||
// initialValue: DeviceModel.temperature,
|
|
||||||
onChange: (value) {
|
|
||||||
String valueAsString = value.toStringAsFixed(1);
|
|
||||||
if (valueAsString.endsWith(".0") ||
|
|
||||||
valueAsString.endsWith(".5")) {
|
|
||||||
value = double.parse(valueAsString);
|
|
||||||
// DevicesCubit.get(context)
|
|
||||||
// .setACTemp(DeviceModel, value);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
),
|
),
|
||||||
|
// min: DeviceModel.bounds.min,
|
||||||
|
// max: DeviceModel.bounds.max,
|
||||||
|
// initialValue: DeviceModel.temperature,
|
||||||
|
onChange: (value) {
|
||||||
|
String valueAsString = value.toStringAsFixed(1);
|
||||||
|
if (valueAsString.endsWith(".0") ||
|
||||||
|
valueAsString.endsWith(".5")) {
|
||||||
|
value = double.parse(valueAsString);
|
||||||
|
// DevicesCubit.get(context)
|
||||||
|
// .setACTemp(DeviceModel, value);
|
||||||
|
}
|
||||||
|
},
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
),
|
||||||
flex: 2,
|
Expanded(
|
||||||
child: Row(
|
flex: 2,
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
child: Row(
|
||||||
children: <Widget>[
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
||||||
SizedBox.square(
|
children: <Widget>[
|
||||||
dimension: 24,
|
SizedBox.square(
|
||||||
child: InkWell(
|
dimension: 24,
|
||||||
onTap: () {
|
child: InkWell(
|
||||||
// DevicesCubit.get(context)
|
onTap: () {
|
||||||
// .setACTemp(DeviceModel, DeviceModel.coolTo);
|
// DevicesCubit.get(context)
|
||||||
// DeviceModel.coolTo -= .5;
|
// .setACTemp(DeviceModel, DeviceModel.coolTo);
|
||||||
},
|
// DeviceModel.coolTo -= .5;
|
||||||
child: SvgPicture.asset(
|
},
|
||||||
Assets.iconsMinus,
|
child: SvgPicture.asset(
|
||||||
),
|
Assets.iconsMinus,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Column(
|
),
|
||||||
children: [
|
Column(
|
||||||
BodyLarge(
|
children: [
|
||||||
// text: "${DeviceModel.coolTo}° C",
|
BodyLarge(
|
||||||
text: '24° C',
|
// text: "${DeviceModel.coolTo}° C",
|
||||||
style: context.bodyLarge.copyWith(
|
text: '24° C',
|
||||||
color:
|
style: context.bodyLarge.copyWith(
|
||||||
ColorsManager.primaryColor.withOpacity(0.6),
|
color:
|
||||||
fontWeight: FontsManager.bold,
|
ColorsManager.primaryColor.withOpacity(0.6),
|
||||||
fontSize: 30,
|
fontWeight: FontsManager.bold,
|
||||||
height: 0),
|
fontSize: 30,
|
||||||
),
|
height: 0),
|
||||||
const BodyMedium(
|
),
|
||||||
text: 'COOL TO',
|
const BodyMedium(
|
||||||
fontSize: 18,
|
text: 'COOL TO',
|
||||||
)
|
fontSize: 18,
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
SizedBox.square(
|
),
|
||||||
dimension: 24,
|
SizedBox.square(
|
||||||
child: InkWell(
|
dimension: 24,
|
||||||
onTap: () {
|
child: InkWell(
|
||||||
// DevicesCubit.get(context)
|
onTap: () {
|
||||||
// .setACTemp(DeviceModel, DeviceModel.coolTo);
|
// DevicesCubit.get(context)
|
||||||
// DeviceModel.coolTo += .5;
|
// .setACTemp(DeviceModel, DeviceModel.coolTo);
|
||||||
},
|
// DeviceModel.coolTo += .5;
|
||||||
child: SvgPicture.asset(
|
},
|
||||||
Assets.iconsPlus,
|
child: SvgPicture.asset(
|
||||||
height: 24,
|
Assets.iconsPlus,
|
||||||
width: 24,
|
height: 24,
|
||||||
),
|
width: 24,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
],
|
),
|
||||||
),
|
],
|
||||||
)
|
),
|
||||||
],
|
)
|
||||||
),
|
],
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,61 +16,57 @@ class ACsView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
create: (context) => DevicesCubit(),
|
builder: (context, state) {
|
||||||
child: BlocBuilder<DevicesCubit, DevicesState>(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return BlocBuilder<DevicesCubit, DevicesState>(
|
DeviceModel? selectedAC;
|
||||||
builder: (context, state) {
|
if (DevicesCubit.get(context).getSelectedDevice() is DeviceModel) {
|
||||||
DeviceModel? selectedAC;
|
selectedAC =
|
||||||
if (DevicesCubit.get(context).getSelectedDevice()
|
DevicesCubit.get(context).getSelectedDevice() as DeviceModel;
|
||||||
is DeviceModel) {
|
}
|
||||||
selectedAC = DevicesCubit.get(context).getSelectedDevice()
|
return AnnotatedRegion(
|
||||||
as DeviceModel;
|
value: SystemUiOverlayStyle(
|
||||||
}
|
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
||||||
return AnnotatedRegion(
|
statusBarIconBrightness: Brightness.light,
|
||||||
value: SystemUiOverlayStyle(
|
),
|
||||||
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
child: SafeArea(
|
||||||
statusBarIconBrightness: Brightness.light,
|
child: Scaffold(
|
||||||
),
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
child: SafeArea(
|
extendBodyBehindAppBar: true,
|
||||||
child: Scaffold(
|
extendBody: true,
|
||||||
backgroundColor: ColorsManager.backgroundColor,
|
appBar: const CategoryViewAppBar(),
|
||||||
extendBodyBehindAppBar: true,
|
body: Container(
|
||||||
extendBody: true,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
appBar: const CategoryViewAppBar(),
|
height: MediaQuery.sizeOf(context).height,
|
||||||
body: Container(
|
decoration: const BoxDecoration(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
image: DecorationImage(
|
||||||
height: MediaQuery.sizeOf(context).height,
|
image: AssetImage(
|
||||||
decoration: const BoxDecoration(
|
Assets.imagesBackground,
|
||||||
image: DecorationImage(
|
|
||||||
image: AssetImage(
|
|
||||||
Assets.imagesBackground,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
opacity: 0.4,
|
|
||||||
),
|
),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
opacity: 0.4,
|
||||||
),
|
),
|
||||||
child: Padding(
|
),
|
||||||
padding: EdgeInsets.only(
|
child: Padding(
|
||||||
top: Constants.appBarHeight,
|
padding: EdgeInsets.only(
|
||||||
left: Constants.defaultPadding,
|
top: Constants.appBarHeight,
|
||||||
right: Constants.defaultPadding,
|
left: Constants.defaultPadding,
|
||||||
),
|
right: Constants.defaultPadding,
|
||||||
child: SizedBox.expand(
|
),
|
||||||
child: selectedAC != null
|
child: SizedBox.expand(
|
||||||
? AcInterface(deviceModel: selectedAC)
|
child: selectedAC != null
|
||||||
: const ACsList(),
|
? AcInterface(deviceModel: selectedAC)
|
||||||
),
|
: const ACsList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
);
|
},
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -13,47 +13,44 @@ class CurtainView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
create: (context) => DevicesCubit(),
|
builder: (context, state) {
|
||||||
child: BlocBuilder<DevicesCubit, DevicesState>(
|
return AnnotatedRegion(
|
||||||
builder: (context, state) {
|
value: SystemUiOverlayStyle(
|
||||||
return AnnotatedRegion(
|
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
||||||
value: SystemUiOverlayStyle(
|
statusBarIconBrightness: Brightness.light,
|
||||||
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
),
|
||||||
statusBarIconBrightness: Brightness.light,
|
child: SafeArea(
|
||||||
),
|
child: Scaffold(
|
||||||
child: SafeArea(
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
child: Scaffold(
|
extendBodyBehindAppBar: true,
|
||||||
backgroundColor: ColorsManager.backgroundColor,
|
extendBody: true,
|
||||||
extendBodyBehindAppBar: true,
|
appBar: const CategoryViewAppBar(),
|
||||||
extendBody: true,
|
body: Container(
|
||||||
appBar: const CategoryViewAppBar(),
|
width: MediaQuery.sizeOf(context).width,
|
||||||
body: Container(
|
height: MediaQuery.sizeOf(context).height,
|
||||||
width: MediaQuery.sizeOf(context).width,
|
decoration: const BoxDecoration(
|
||||||
height: MediaQuery.sizeOf(context).height,
|
image: DecorationImage(
|
||||||
decoration: const BoxDecoration(
|
image: AssetImage(
|
||||||
image: DecorationImage(
|
Assets.imagesBackground,
|
||||||
image: AssetImage(
|
|
||||||
Assets.imagesBackground,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
opacity: 0.4,
|
|
||||||
),
|
),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
opacity: 0.4,
|
||||||
),
|
),
|
||||||
child: Padding(
|
),
|
||||||
padding: EdgeInsets.only(
|
child: Padding(
|
||||||
top: Constants.appBarHeight,
|
padding: EdgeInsets.only(
|
||||||
left: Constants.defaultPadding,
|
top: Constants.appBarHeight,
|
||||||
right: Constants.defaultPadding,
|
left: Constants.defaultPadding,
|
||||||
),
|
right: Constants.defaultPadding,
|
||||||
child: const CurtainList(),
|
|
||||||
),
|
),
|
||||||
|
child: const CurtainList(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import 'package:syncrow_app/features/devices/view/widgets/devices_view_header.da
|
|||||||
import 'package:syncrow_app/features/devices/view/widgets/room_page.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/room_page.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/rooms_slider.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/rooms_slider.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/wizard_page.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/wizard_page.dart';
|
||||||
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
|
|
||||||
import '../../bloc/devices_cubit.dart';
|
import '../../bloc/devices_cubit.dart';
|
||||||
@ -17,73 +18,75 @@ class DevicesViewBody extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocBuilder<SpacesCubit, SpacesState>(
|
||||||
create: (context) => DevicesCubit(),
|
builder: (context, state) {
|
||||||
child: BlocBuilder<SpacesCubit, SpacesState>(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return BlocBuilder<DevicesCubit, DevicesState>(
|
//TODO : move to NavigationCubit
|
||||||
builder: (context, state) {
|
if (state is DevicesLoading) {
|
||||||
//TODO : move to NavigationCubit
|
return const Center(child: CircularProgressIndicator());
|
||||||
if (state is DevicesLoading) {
|
} else {
|
||||||
return const Center(child: CircularProgressIndicator());
|
return Padding(
|
||||||
} else {
|
padding: EdgeInsets.only(
|
||||||
return Padding(
|
top: Constants.appBarHeight,
|
||||||
padding: EdgeInsets.only(
|
bottom: Constants.bottomNavBarHeight,
|
||||||
top: Constants.appBarHeight,
|
),
|
||||||
bottom: Constants.bottomNavBarHeight,
|
child: Column(
|
||||||
),
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
child: Column(
|
children: [
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
const DevicesViewHeader(),
|
||||||
children: [
|
const RoomsSlider(),
|
||||||
const DevicesViewHeader(),
|
const SizedBox(
|
||||||
const RoomsSlider(),
|
height: 10,
|
||||||
const SizedBox(
|
),
|
||||||
height: 10,
|
Expanded(
|
||||||
|
child: PageView(
|
||||||
|
controller:
|
||||||
|
SpacesCubit.get(context).devicesPageController,
|
||||||
|
onPageChanged: (index) {
|
||||||
|
SpacesCubit.get(context).devicesPageChanged(index);
|
||||||
|
},
|
||||||
|
children: [
|
||||||
|
const WizardPage(),
|
||||||
|
if (SpacesCubit.selectedSpace != null)
|
||||||
|
if (SpacesCubit.selectedSpace!.rooms != null)
|
||||||
|
...SpacesCubit.selectedSpace!.rooms!.map(
|
||||||
|
(room) {
|
||||||
|
return RoomPage(
|
||||||
|
room: room,
|
||||||
|
);
|
||||||
|
},
|
||||||
|
)
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Expanded(
|
),
|
||||||
child: PageView(
|
SpacesCubit.selectedSpace != null
|
||||||
controller:
|
? Padding(
|
||||||
SpacesCubit.get(context).devicesPageController,
|
padding: const EdgeInsets.symmetric(
|
||||||
onPageChanged: (index) {
|
vertical: 7,
|
||||||
SpacesCubit.get(context).devicesPageChanged(index);
|
),
|
||||||
},
|
child: SmoothPageIndicator(
|
||||||
children: [
|
controller: SpacesCubit.get(context)
|
||||||
const WizardPage(),
|
.devicesPageController,
|
||||||
if (SpacesCubit.selectedSpace != null)
|
count:
|
||||||
if (SpacesCubit.selectedSpace!.rooms != null)
|
SpacesCubit.selectedSpace!.rooms!.length + 1,
|
||||||
...SpacesCubit.selectedSpace!.rooms!.map(
|
effect: const WormEffect(
|
||||||
(room) {
|
paintStyle: PaintingStyle.stroke,
|
||||||
return RoomPage(
|
dotHeight: 8,
|
||||||
room: room,
|
dotWidth: 8,
|
||||||
);
|
),
|
||||||
},
|
),
|
||||||
)
|
)
|
||||||
],
|
: const Center(
|
||||||
),
|
child: BodyLarge(text: 'No Home Found'),
|
||||||
),
|
|
||||||
Padding(
|
|
||||||
padding: const EdgeInsets.symmetric(
|
|
||||||
vertical: 7,
|
|
||||||
),
|
|
||||||
child: SmoothPageIndicator(
|
|
||||||
controller:
|
|
||||||
SpacesCubit.get(context).devicesPageController,
|
|
||||||
count: SpacesCubit.selectedSpace!.rooms!.length + 1,
|
|
||||||
effect: const WormEffect(
|
|
||||||
paintStyle: PaintingStyle.stroke,
|
|
||||||
dotHeight: 8,
|
|
||||||
dotWidth: 8,
|
|
||||||
),
|
),
|
||||||
),
|
],
|
||||||
),
|
),
|
||||||
],
|
);
|
||||||
),
|
}
|
||||||
);
|
},
|
||||||
}
|
);
|
||||||
},
|
},
|
||||||
);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,58 +14,54 @@ class LightsView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocProvider(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
create: (context) => DevicesCubit(),
|
builder: (context, state) {
|
||||||
child: BlocBuilder<DevicesCubit, DevicesState>(
|
return BlocBuilder<DevicesCubit, DevicesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return BlocBuilder<DevicesCubit, DevicesState>(
|
DeviceModel? selectedLight;
|
||||||
builder: (context, state) {
|
if (DevicesCubit.get(context).getSelectedDevice() is DeviceModel) {
|
||||||
DeviceModel? selectedLight;
|
selectedLight =
|
||||||
if (DevicesCubit.get(context).getSelectedDevice()
|
DevicesCubit.get(context).getSelectedDevice() as DeviceModel;
|
||||||
is DeviceModel) {
|
}
|
||||||
selectedLight = DevicesCubit.get(context).getSelectedDevice()
|
List<DeviceModel> lights = [];
|
||||||
as DeviceModel;
|
if (DevicesCubit.allCategories![1].devices != null) {
|
||||||
|
for (var device in DevicesCubit.allCategories![1].devices!) {
|
||||||
|
lights.add(device);
|
||||||
}
|
}
|
||||||
List<DeviceModel> lights = [];
|
}
|
||||||
if (DevicesCubit.allCategories![1].devices != null) {
|
return AnnotatedRegion(
|
||||||
for (var device in DevicesCubit.allCategories![1].devices!) {
|
value: SystemUiOverlayStyle(
|
||||||
lights.add(device);
|
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
||||||
}
|
statusBarIconBrightness: Brightness.light,
|
||||||
}
|
),
|
||||||
return AnnotatedRegion(
|
child: SafeArea(
|
||||||
value: SystemUiOverlayStyle(
|
child: Scaffold(
|
||||||
statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
|
backgroundColor: ColorsManager.backgroundColor,
|
||||||
statusBarIconBrightness: Brightness.light,
|
extendBodyBehindAppBar: true,
|
||||||
),
|
extendBody: true,
|
||||||
child: SafeArea(
|
appBar: const CategoryViewAppBar(),
|
||||||
child: Scaffold(
|
body: Container(
|
||||||
backgroundColor: ColorsManager.backgroundColor,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
extendBodyBehindAppBar: true,
|
height: MediaQuery.sizeOf(context).height,
|
||||||
extendBody: true,
|
decoration: const BoxDecoration(
|
||||||
appBar: const CategoryViewAppBar(),
|
image: DecorationImage(
|
||||||
body: Container(
|
image: AssetImage(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
Assets.imagesBackground,
|
||||||
height: MediaQuery.sizeOf(context).height,
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
image: DecorationImage(
|
|
||||||
image: AssetImage(
|
|
||||||
Assets.imagesBackground,
|
|
||||||
),
|
|
||||||
fit: BoxFit.cover,
|
|
||||||
opacity: 0.4,
|
|
||||||
),
|
),
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
opacity: 0.4,
|
||||||
),
|
),
|
||||||
child: selectedLight != null
|
|
||||||
? LightInterface(light: selectedLight)
|
|
||||||
: LightsViewList(lights: lights),
|
|
||||||
),
|
),
|
||||||
|
child: selectedLight != null
|
||||||
|
? LightInterface(light: selectedLight)
|
||||||
|
: LightsViewList(lights: lights),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
),
|
||||||
},
|
);
|
||||||
);
|
},
|
||||||
},
|
);
|
||||||
),
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.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/model/device_model.dart';
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/model/function_model.dart';
|
import 'package:syncrow_app/features/devices/model/function_model.dart';
|
||||||
import 'package:syncrow_app/features/devices/view/widgets/ACs/category_view_app_bar.dart';
|
import 'package:syncrow_app/features/devices/view/widgets/ACs/category_view_app_bar.dart';
|
||||||
@ -26,7 +27,7 @@ class LightSwitchesView extends StatelessWidget {
|
|||||||
extendBodyBehindAppBar: true,
|
extendBodyBehindAppBar: true,
|
||||||
extendBody: true,
|
extendBody: true,
|
||||||
appBar: const CategoryViewAppBar(),
|
appBar: const CategoryViewAppBar(),
|
||||||
body: BlocBuilder<NavCubit, NavState>(
|
body: BlocBuilder<SpacesCubit, SpacesState>(
|
||||||
builder: (context, state) {
|
builder: (context, state) {
|
||||||
return Container(
|
return Container(
|
||||||
width: MediaQuery.sizeOf(context).width,
|
width: MediaQuery.sizeOf(context).width,
|
||||||
|
@ -12,13 +12,13 @@ class SplashView extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return BlocBuilder<AuthCubit, AuthState>(
|
return BlocConsumer<AuthCubit, AuthState>(
|
||||||
builder: (context, state) {
|
listener: (context, state) {
|
||||||
if (state is AuthTokenSuccess) {
|
if (state is AuthTokenSuccess) {
|
||||||
Future.delayed(const Duration(seconds: 1), () {
|
Future.delayed(const Duration(seconds: 1), () {
|
||||||
Navigator.pushReplacementNamed(context, Routes.homeRoute);
|
Navigator.pushReplacementNamed(context, Routes.homeRoute);
|
||||||
});
|
});
|
||||||
} else {
|
} else if (state is AuthTokenError) {
|
||||||
Future.delayed(const Duration(seconds: 1), () {
|
Future.delayed(const Duration(seconds: 1), () {
|
||||||
Navigator.pushReplacement(
|
Navigator.pushReplacement(
|
||||||
context,
|
context,
|
||||||
@ -26,7 +26,8 @@ class SplashView extends StatelessWidget {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
builder: (context, state) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
body: Stack(
|
body: Stack(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_bloc/flutter_bloc.dart';
|
import 'package:flutter_bloc/flutter_bloc.dart';
|
||||||
import 'package:syncrow_app/features/app_layout/bloc/nav_cubit.dart';
|
|
||||||
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
import 'package:syncrow_app/features/auth/bloc/auth_cubit.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
||||||
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
import 'package:syncrow_app/utils/resource_manager/constants.dart';
|
||||||
@ -24,10 +23,6 @@ class MyApp extends StatelessWidget {
|
|||||||
BlocProvider(
|
BlocProvider(
|
||||||
create: (context) => AuthCubit(),
|
create: (context) => AuthCubit(),
|
||||||
),
|
),
|
||||||
BlocProvider(
|
|
||||||
lazy: false,
|
|
||||||
create: (context) => NavCubit(),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
child: MaterialApp(
|
child: MaterialApp(
|
||||||
debugShowCheckedModeBanner: false,
|
debugShowCheckedModeBanner: false,
|
||||||
|
Reference in New Issue
Block a user