mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 18:16:21 +00:00
Hide nonfunctional widgets
This commit is contained in:
@ -55,7 +55,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
|
||||
Future fetchUserInfo() async {
|
||||
try {
|
||||
var uuid=await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
||||
var uuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey);
|
||||
user = await ProfileApi().fetchUserInfo(uuid);
|
||||
emit(HomeUserInfoLoaded(user!)); // Emit state after fetching user info
|
||||
} catch (e) {
|
||||
@ -123,9 +123,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
return;
|
||||
}
|
||||
|
||||
var userUuid =
|
||||
await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ??
|
||||
'';
|
||||
var userUuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? '';
|
||||
if (userUuid.isNotEmpty) {
|
||||
await OneSignal.login(userUuid);
|
||||
}
|
||||
@ -221,8 +219,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
//////////////////////////////////////// API ////////////////////////////////////////
|
||||
generateInvitation(SpaceModel unit) async {
|
||||
try {
|
||||
final invitationCode =
|
||||
await SpacesAPI.generateInvitationCode(unit.id, unit.community.uuid);
|
||||
final invitationCode = await SpacesAPI.generateInvitationCode(unit.id, unit.community.uuid);
|
||||
if (invitationCode.isNotEmpty) {
|
||||
Share.share('The invitation code is $invitationCode');
|
||||
CustomSnackBar.displaySnackBar(
|
||||
@ -238,9 +235,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
|
||||
Future<bool> joinAUnit(String code) async {
|
||||
try {
|
||||
var userUuid =
|
||||
await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ??
|
||||
'';
|
||||
var userUuid = await const FlutterSecureStorage().read(key: UserModel.userUuidKey) ?? '';
|
||||
Map<String, String> body = {'inviteCode': code};
|
||||
|
||||
final success = await SpacesAPI.joinUnit(userUuid, body);
|
||||
@ -276,8 +271,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
fetchRoomsByUnitId(SpaceModel space) async {
|
||||
emitSafe(GetSpaceRoomsLoading());
|
||||
try {
|
||||
space.subspaces =
|
||||
await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id);
|
||||
space.subspaces = await SpacesAPI.getSubSpaceBySpaceId(space.community.uuid, space.id);
|
||||
} catch (failure) {
|
||||
emitSafe(GetSpaceRoomsError(failure.toString()));
|
||||
return;
|
||||
@ -359,8 +353,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
size: 32,
|
||||
),
|
||||
style: ButtonStyle(
|
||||
foregroundColor:
|
||||
WidgetStateProperty.all(ColorsManager.textPrimaryColor),
|
||||
foregroundColor: WidgetStateProperty.all(ColorsManager.textPrimaryColor),
|
||||
),
|
||||
onPressed: () {
|
||||
Navigator.pushNamed(
|
||||
@ -381,35 +374,34 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
NavigationService.navigatorKey.currentContext!
|
||||
.read<SmartSceneSelectBloc>()
|
||||
.add(const SmartSceneClearEvent());
|
||||
BlocProvider.of<EffectPeriodBloc>(
|
||||
NavigationService.navigatorKey.currentState!.context)
|
||||
BlocProvider.of<EffectPeriodBloc>(NavigationService.navigatorKey.currentState!.context)
|
||||
.add(ResetEffectivePeriod());
|
||||
NavigationService.navigatorKey.currentContext!
|
||||
.read<CreateSceneBloc>()
|
||||
.add(const ClearTabToRunSetting());
|
||||
},
|
||||
),
|
||||
IconButton(
|
||||
icon: const Icon(
|
||||
Icons.more_vert,
|
||||
size: 28,
|
||||
),
|
||||
style: ButtonStyle(
|
||||
foregroundColor:
|
||||
WidgetStateProperty.all(ColorsManager.textPrimaryColor),
|
||||
),
|
||||
onPressed: () {},
|
||||
),
|
||||
// IconButton(
|
||||
// icon: const Icon(
|
||||
// Icons.more_vert,
|
||||
// size: 28,
|
||||
// ),
|
||||
// style: ButtonStyle(
|
||||
// foregroundColor:
|
||||
// WidgetStateProperty.all(ColorsManager.textPrimaryColor),
|
||||
// ),
|
||||
// onPressed: () {},
|
||||
// ),
|
||||
],
|
||||
'Menu': [
|
||||
IconButton(
|
||||
icon: SvgPicture.asset(
|
||||
Assets.assetsIconsScan,
|
||||
height: 20,
|
||||
width: 20,
|
||||
),
|
||||
onPressed: () {},
|
||||
),
|
||||
// IconButton(
|
||||
// icon: SvgPicture.asset(
|
||||
// Assets.assetsIconsScan,
|
||||
// height: 20,
|
||||
// width: 20,
|
||||
// ),
|
||||
// onPressed: () {},
|
||||
// ),
|
||||
],
|
||||
};
|
||||
|
||||
@ -429,8 +421,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
};
|
||||
|
||||
static var bottomNavItems = [
|
||||
defaultBottomNavBarItem(
|
||||
icon: Assets.assetsIconsDashboard, label: 'Dashboard'),
|
||||
defaultBottomNavBarItem(icon: Assets.assetsIconsDashboard, label: 'Dashboard'),
|
||||
// defaultBottomNavBarItem(icon: Assets.assetsIconslayout, label: 'Layout'),
|
||||
defaultBottomNavBarItem(icon: Assets.assetsIconsDevices, label: 'Devices'),
|
||||
defaultBottomNavBarItem(icon: Assets.assetsIconsRoutines, label: 'Routine'),
|
||||
@ -456,8 +447,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
|
||||
void updateDevice(String deviceId) async {
|
||||
try {
|
||||
final response = await DevicesAPI.firmwareDevice(
|
||||
deviceId: deviceId, firmwareVersion: '0');
|
||||
final response = await DevicesAPI.firmwareDevice(deviceId: deviceId, firmwareVersion: '0');
|
||||
if (response['success'] ?? false) {
|
||||
CustomSnackBar.displaySnackBar('No updates available');
|
||||
}
|
||||
@ -465,8 +455,7 @@ class HomeCubit extends Cubit<HomeState> {
|
||||
}
|
||||
}
|
||||
|
||||
BottomNavigationBarItem defaultBottomNavBarItem(
|
||||
{required String icon, required String label}) {
|
||||
BottomNavigationBarItem defaultBottomNavBarItem({required String icon, required String label}) {
|
||||
return BottomNavigationBarItem(
|
||||
icon: SvgPicture.asset(icon),
|
||||
activeIcon: SvgPicture.asset(
|
||||
|
Reference in New Issue
Block a user