Merge branch 'dev' of https://github.com/SyncrowIOT/web into SP-1278-FE-Allow-Simple-Edit-Delete

This commit is contained in:
Faris Armoush
2025-04-15 12:03:25 +03:00
12 changed files with 480 additions and 476 deletions

View File

@ -0,0 +1,4 @@
<svg width="8" height="9" viewBox="0 0 8 9" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M7.13918 0.5H4.10294C4.0408 0.5 3.98117 0.524721 3.93722 0.568668L0.251783 4.25398C-0.0839278 4.58982 -0.0839278 5.13617 0.251783 5.47188L3.02848 8.24852C3.1906 8.41064 3.40686 8.49994 3.63734 8.5H3.6374C3.86794 8.5 4.0842 8.41064 4.24638 8.24846L7.9317 4.56308C7.97565 4.51914 8.00037 4.4595 8.00037 4.39736L8.00043 1.36113C8.00037 0.886312 7.61399 0.5 7.13918 0.5ZM7.53159 4.30031L3.91488 7.91702C3.84127 7.9907 3.74269 8.03122 3.6374 8.03122C3.53205 8.03122 3.43353 7.9907 3.35992 7.91708L0.583222 5.14045C0.43026 4.98748 0.43026 4.73845 0.583222 4.58542L4.19999 0.968775H7.13918C7.35556 0.968775 7.53165 1.14481 7.53165 1.36119L7.53159 4.30031Z" fill="#999999"/>
<path d="M5.93455 1.8291C5.73782 1.8291 5.55288 1.90577 5.41377 2.04487C5.27466 2.18392 5.19806 2.36886 5.19806 2.56559C5.19806 2.76232 5.27466 2.94726 5.41377 3.08637C5.55288 3.22548 5.73782 3.30208 5.93455 3.30208C6.13121 3.30208 6.31616 3.22548 6.45527 3.08637C6.59437 2.94726 6.67098 2.76232 6.67098 2.56559C6.67098 2.36886 6.59437 2.18392 6.45533 2.04487C6.31622 1.90577 6.13128 1.8291 5.93455 1.8291ZM6.12383 2.75487C6.07329 2.80547 6.00602 2.83331 5.93455 2.83331C5.86301 2.83331 5.79581 2.80547 5.74527 2.75487C5.69467 2.70433 5.66683 2.63707 5.66683 2.56559C5.66683 2.49412 5.69467 2.42685 5.74527 2.37631C5.79581 2.32571 5.86307 2.29788 5.93455 2.29788C6.00602 2.29788 6.07323 2.32571 6.12383 2.37631C6.17443 2.42685 6.20226 2.49412 6.20226 2.56559C6.20226 2.63707 6.17437 2.70433 6.12383 2.75487Z" fill="#999999"/>
</svg>

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -331,9 +331,13 @@ class AcBloc extends Bloc<AcsEvent, AcsState> {
try { try {
final scaledValue = totalMinutes ~/ 6; final scaledValue = totalMinutes ~/ 6;
await DevicesManagementApi().deviceControl( await _runDebounce(
deviceId, isBatch: false,
Status(code: 'countdown_time', value: scaledValue), deviceId: deviceId,
code: 'countdown_time',
value: scaledValue,
oldValue: scaledValue,
emit: emit,
); );
_startCountdownTimer(emit); _startCountdownTimer(emit);
emit(currentState.copyWith(isTimerActive: timerActive)); emit(currentState.copyWith(isTimerActive: timerActive));
@ -342,9 +346,13 @@ class AcBloc extends Bloc<AcsEvent, AcsState> {
emit(AcsFailedState(error: e.toString())); emit(AcsFailedState(error: e.toString()));
} }
} else { } else {
await DevicesManagementApi().deviceControl( await _runDebounce(
deviceId, isBatch: false,
Status(code: 'countdown_time', value: 0), deviceId: deviceId,
code: 'countdown_time',
value: 0,
oldValue: 0,
emit: emit,
); );
_countdownTimer?.cancel(); _countdownTimer?.cancel();
scheduledHours = 0; scheduledHours = 0;

View File

@ -0,0 +1,18 @@
class DeviceSubSpace {
String? id;
String? createdAt;
String? updatedAt;
String? subspaceName;
bool? disabled;
DeviceSubSpace({this.id, this.createdAt, this.updatedAt, this.subspaceName, this.disabled});
DeviceSubSpace.fromJson(Map<String, dynamic> json) {
id = json['uuid']?.toString() ?? '';
createdAt = json['createdAt']?.toString() ?? '';
updatedAt = json['updatedAt']?.toString() ?? '';
subspaceName = json['subspaceName']?.toString() ?? '';
subspaceName = json['subspaceName']?.toString() ?? '';
disabled = json['disabled'] ?? false;
}
}

View File

@ -0,0 +1,20 @@
class DeviceTagModel {
String? id;
String? createdAt;
String? updatedAt;
String? name;
DeviceTagModel({
this.id,
this.createdAt,
this.updatedAt,
this.name,
});
DeviceTagModel.fromJson(Map<String, dynamic> json) {
id = json['uuid']?.toString() ?? '';
createdAt = json['createdAt']?.toString() ?? '';
updatedAt = json['updatedAt']?.toString() ?? '';
name = json['name']?.toString() ?? '';
}
}

View File

@ -1,6 +1,8 @@
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_community.model.dart'; import 'package:syncrow_web/pages/device_managment/all_devices/models/device_community.model.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_space_model.dart'; import 'package:syncrow_web/pages/device_managment/all_devices/models/device_space_model.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_sub_space.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_subspace.model.dart'; import 'package:syncrow_web/pages/device_managment/all_devices/models/device_subspace.model.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/device_tag_model.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/room.dart'; import 'package:syncrow_web/pages/device_managment/all_devices/models/room.dart';
import 'package:syncrow_web/pages/device_managment/all_devices/models/unit.dart'; import 'package:syncrow_web/pages/device_managment/all_devices/models/unit.dart';
import 'package:syncrow_web/pages/routines/models/ac/ac_function.dart'; import 'package:syncrow_web/pages/routines/models/ac/ac_function.dart';
@ -79,9 +81,11 @@ class AllDevicesModel {
int? batteryLevel; int? batteryLevel;
String? productName; String? productName;
List<DeviceSpaceModel>? spaces; List<DeviceSpaceModel>? spaces;
List<DeviceTagModel>? deviceTags;
DeviceSubSpace? deviceSubSpace;
AllDevicesModel({ AllDevicesModel(
this.room, {this.room,
this.subspace, this.subspace,
this.unit, this.unit,
this.community, this.community,
@ -110,7 +114,8 @@ class AllDevicesModel {
this.batteryLevel, this.batteryLevel,
this.productName, this.productName,
this.spaces, this.spaces,
}); this.deviceTags,
this.deviceSubSpace});
AllDevicesModel.fromJson(Map<String, dynamic> json) { AllDevicesModel.fromJson(Map<String, dynamic> json) {
room = (json['room'] != null && (json['room'] is Map)) room = (json['room'] != null && (json['room'] is Map))
@ -148,12 +153,15 @@ class AllDevicesModel {
updateTime = int.tryParse(json['updateTime']?.toString() ?? ''); updateTime = int.tryParse(json['updateTime']?.toString() ?? '');
uuid = json['uuid']?.toString(); uuid = json['uuid']?.toString();
batteryLevel = int.tryParse(json['battery']?.toString() ?? ''); batteryLevel = int.tryParse(json['battery']?.toString() ?? '');
productName = json['productName']?.toString(); productName = json['productName']?.toString();
deviceTags = json['deviceTag'] != null && json['deviceTag'] is List
? (json['deviceTag'] as List).map((tag) => DeviceTagModel.fromJson(tag)).toList()
: [];
deviceSubSpace = json['subspace'] != null
? DeviceSubSpace.fromJson(json['subspace'])
: DeviceSubSpace(subspaceName: '');
if (json['spaces'] != null && json['spaces'] is List) { if (json['spaces'] != null && json['spaces'] is List) {
spaces = (json['spaces'] as List) spaces = (json['spaces'] as List).map((space) => DeviceSpaceModel.fromJson(space)).toList();
.map((space) => DeviceSpaceModel.fromJson(space))
.toList();
} }
} }
@ -201,8 +209,7 @@ SOS
String tempIcon = ''; String tempIcon = '';
if (type == DeviceType.LightBulb) { if (type == DeviceType.LightBulb) {
tempIcon = Assets.lightBulb; tempIcon = Assets.lightBulb;
} else if (type == DeviceType.CeilingSensor || } else if (type == DeviceType.CeilingSensor || type == DeviceType.WallSensor) {
type == DeviceType.WallSensor) {
tempIcon = Assets.sensors; tempIcon = Assets.sensors;
} else if (type == DeviceType.AC) { } else if (type == DeviceType.AC) {
tempIcon = Assets.ac; tempIcon = Assets.ac;
@ -249,76 +256,51 @@ SOS
switch (productType) { switch (productType) {
case 'AC': case 'AC':
return [ return [
SwitchFunction( SwitchFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'), ModeFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
ModeFunction( TempSetFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'), CurrentTempFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
TempSetFunction( LevelFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'), ChildLockFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
CurrentTempFunction(
deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
LevelFunction(
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
ChildLockFunction(
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
]; ];
case '1G': case '1G':
return [ return [
OneGangSwitchFunction(deviceId: uuid ?? '', deviceName: name ?? ''), OneGangSwitchFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
OneGangCountdownFunction( OneGangCountdownFunction(deviceId: uuid ?? '', deviceName: name ?? ''),
deviceId: uuid ?? '', deviceName: name ?? ''),
]; ];
case '2G': case '2G':
return [ return [
TwoGangSwitch1Function(deviceId: uuid ?? '', deviceName: name ?? ''), TwoGangSwitch1Function(deviceId: uuid ?? '', deviceName: name ?? ''),
TwoGangSwitch2Function(deviceId: uuid ?? '', deviceName: name ?? ''), TwoGangSwitch2Function(deviceId: uuid ?? '', deviceName: name ?? ''),
TwoGangCountdown1Function( TwoGangCountdown1Function(deviceId: uuid ?? '', deviceName: name ?? ''),
deviceId: uuid ?? '', deviceName: name ?? ''), TwoGangCountdown2Function(deviceId: uuid ?? '', deviceName: name ?? ''),
TwoGangCountdown2Function(
deviceId: uuid ?? '', deviceName: name ?? ''),
]; ];
case '3G': case '3G':
return [ return [
ThreeGangSwitch1Function( ThreeGangSwitch1Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'), ThreeGangSwitch2Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
ThreeGangSwitch2Function( ThreeGangSwitch3Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'), ThreeGangCountdown1Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
ThreeGangSwitch3Function( ThreeGangCountdown2Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'), ThreeGangCountdown3Function(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
ThreeGangCountdown1Function(
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
ThreeGangCountdown2Function(
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
ThreeGangCountdown3Function(
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
]; ];
case 'WPS': case 'WPS':
return [ return [
//IF Functions //IF Functions
PresenceStateFunction( PresenceStateFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'), CurrentDistanceFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
CurrentDistanceFunction( IlluminanceValueFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'), PresenceTimeFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
IlluminanceValueFunction(
deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
PresenceTimeFunction(
deviceId: uuid ?? '', deviceName: name ?? '', type: 'IF'),
//THEN Functions //THEN Functions
FarDetectionFunction( FarDetectionFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'), MotionSensitivityFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
MotionSensitivityFunction( MotionLessSensitivityFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'), IndicatorFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
MotionLessSensitivityFunction( NoOneTimeFunction(deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
IndicatorFunction(
deviceId: uuid ?? '', deviceName: name ?? '', type: 'BOTH'),
NoOneTimeFunction(
deviceId: uuid ?? '', deviceName: name ?? '', type: 'THEN'),
]; ];
case 'GW': case 'GW':
return [ return [

View File

@ -62,9 +62,6 @@ class ToggleWidget extends StatelessWidget {
)), )),
if (showToggle) if (showToggle)
Container( Container(
height: 20,
width: 35,
padding: const EdgeInsets.only(right: 16, top: 10),
child: CupertinoSwitch( child: CupertinoSwitch(
value: value, value: value,
activeColor: ColorsManager.dialogBlueTitle, activeColor: ColorsManager.dialogBlueTitle,

View File

@ -30,6 +30,7 @@ class FunctionBloc extends Bloc<FunctionBlocEvent, FunctionBlocState> {
condition: event.functionData.condition ?? existingData.condition, condition: event.functionData.condition ?? existingData.condition,
); );
} else { } else {
functions.clear();
functions.add(event.functionData); functions.add(event.functionData);
} }

View File

@ -64,8 +64,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
TriggerSwitchTabsEvent event, TriggerSwitchTabsEvent event,
Emitter<RoutineState> emit, Emitter<RoutineState> emit,
) { ) {
emit(state.copyWith( emit(state.copyWith(routineTab: event.isRoutineTab, createRoutineView: false));
routineTab: event.isRoutineTab, createRoutineView: false));
add(ResetRoutineState()); add(ResetRoutineState());
if (event.isRoutineTab) { if (event.isRoutineTab) {
add(const LoadScenes()); add(const LoadScenes());
@ -91,8 +90,8 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
final updatedIfItems = List<Map<String, dynamic>>.from(state.ifItems); final updatedIfItems = List<Map<String, dynamic>>.from(state.ifItems);
// Find the index of the item in teh current itemsList // Find the index of the item in teh current itemsList
int index = updatedIfItems.indexWhere( int index =
(map) => map['uniqueCustomId'] == event.item['uniqueCustomId']); updatedIfItems.indexWhere((map) => map['uniqueCustomId'] == event.item['uniqueCustomId']);
// Replace the map if the index is valid // Replace the map if the index is valid
if (index != -1) { if (index != -1) {
updatedIfItems[index] = event.item; updatedIfItems[index] = event.item;
@ -101,21 +100,18 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
if (event.isTabToRun) { if (event.isTabToRun) {
emit(state.copyWith( emit(state.copyWith(ifItems: updatedIfItems, isTabToRun: true, isAutomation: false));
ifItems: updatedIfItems, isTabToRun: true, isAutomation: false));
} else { } else {
emit(state.copyWith( emit(state.copyWith(ifItems: updatedIfItems, isTabToRun: false, isAutomation: true));
ifItems: updatedIfItems, isTabToRun: false, isAutomation: true));
} }
} }
void _onAddToThenContainer( void _onAddToThenContainer(AddToThenContainer event, Emitter<RoutineState> emit) {
AddToThenContainer event, Emitter<RoutineState> emit) {
final currentItems = List<Map<String, dynamic>>.from(state.thenItems); final currentItems = List<Map<String, dynamic>>.from(state.thenItems);
// Find the index of the item in teh current itemsList // Find the index of the item in teh current itemsList
int index = currentItems.indexWhere( int index =
(map) => map['uniqueCustomId'] == event.item['uniqueCustomId']); currentItems.indexWhere((map) => map['uniqueCustomId'] == event.item['uniqueCustomId']);
// Replace the map if the index is valid // Replace the map if the index is valid
if (index != -1) { if (index != -1) {
currentItems[index] = event.item; currentItems[index] = event.item;
@ -126,45 +122,42 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
emit(state.copyWith(thenItems: currentItems)); emit(state.copyWith(thenItems: currentItems));
} }
void _onAddFunctionsToRoutine( void _onAddFunctionsToRoutine(AddFunctionToRoutine event, Emitter<RoutineState> emit) {
AddFunctionToRoutine event, Emitter<RoutineState> emit) {
try { try {
if (event.functions.isEmpty) return; if (event.functions.isEmpty) return;
List<DeviceFunctionData> selectedFunction = // List<DeviceFunctionData> selectedFunction = List<DeviceFunctionData>.from(event.functions);
List<DeviceFunctionData>.from(event.functions);
Map<String, List<DeviceFunctionData>> currentSelectedFunctions = Map<String, List<DeviceFunctionData>> currentSelectedFunctions =
Map<String, List<DeviceFunctionData>>.from(state.selectedFunctions); Map<String, List<DeviceFunctionData>>.from(state.selectedFunctions);
if (currentSelectedFunctions.containsKey(event.uniqueCustomId)) {
List<DeviceFunctionData> currentFunctions =
List<DeviceFunctionData>.from(
currentSelectedFunctions[event.uniqueCustomId] ?? []);
List<String> functionCode = []; // if (currentSelectedFunctions.containsKey(event.uniqueCustomId)) {
for (int i = 0; i < selectedFunction.length; i++) { // List<DeviceFunctionData> currentFunctions =
for (int j = 0; j < currentFunctions.length; j++) { // List<DeviceFunctionData>.from(currentSelectedFunctions[event.uniqueCustomId] ?? []);
if (selectedFunction[i].functionCode ==
currentFunctions[j].functionCode) {
currentFunctions[j] = selectedFunction[i];
if (!functionCode.contains(currentFunctions[j].functionCode)) {
functionCode.add(currentFunctions[j].functionCode);
}
}
}
}
for (int i = 0; i < functionCode.length; i++) { // List<String> functionCode = [];
selectedFunction // for (int i = 0; i < selectedFunction.length; i++) {
.removeWhere((code) => code.functionCode == functionCode[i]); // for (int j = 0; j < currentFunctions.length; j++) {
} // if (selectedFunction[i].functionCode == currentFunctions[j].functionCode) {
// currentFunctions[j] = selectedFunction[i];
// if (!functionCode.contains(currentFunctions[j].functionCode)) {
// functionCode.add(currentFunctions[j].functionCode);
// }
// }
// }
// }
currentSelectedFunctions[event.uniqueCustomId] = // for (int i = 0; i < functionCode.length; i++) {
List.from(currentFunctions)..addAll(selectedFunction); // selectedFunction.removeWhere((code) => code.functionCode == functionCode[i]);
} else { // }
currentSelectedFunctions[event.uniqueCustomId] =
List.from(event.functions); // currentSelectedFunctions[event.uniqueCustomId] = List.from(currentFunctions)
} // ..addAll(selectedFunction);
// } else {
// currentSelectedFunctions[event.uniqueCustomId] = List.from(event.functions);
// }
currentSelectedFunctions[event.uniqueCustomId] = List.from(event.functions);
emit(state.copyWith(selectedFunctions: currentSelectedFunctions)); emit(state.copyWith(selectedFunctions: currentSelectedFunctions));
} catch (e) { } catch (e) {
@ -172,30 +165,24 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
Future<void> _onLoadScenes( Future<void> _onLoadScenes(LoadScenes event, Emitter<RoutineState> emit) async {
LoadScenes event, Emitter<RoutineState> emit) async {
emit(state.copyWith(isLoading: true, errorMessage: null)); emit(state.copyWith(isLoading: true, errorMessage: null));
List<ScenesModel> scenes = []; List<ScenesModel> scenes = [];
try { try {
BuildContext context = NavigationService.navigatorKey.currentContext!; BuildContext context = NavigationService.navigatorKey.currentContext!;
var createRoutineBloc = context.read<CreateRoutineBloc>(); var createRoutineBloc = context.read<CreateRoutineBloc>();
final projectUuid = await ProjectManager.getProjectUUID() ?? ''; final projectUuid = await ProjectManager.getProjectUUID() ?? '';
if (createRoutineBloc.selectedSpaceId == '' && if (createRoutineBloc.selectedSpaceId == '' && createRoutineBloc.selectedCommunityId == '') {
createRoutineBloc.selectedCommunityId == '') {
var spaceBloc = context.read<SpaceTreeBloc>(); var spaceBloc = context.read<SpaceTreeBloc>();
for (var communityId in spaceBloc.state.selectedCommunities) { for (var communityId in spaceBloc.state.selectedCommunities) {
List<String> spacesList = List<String> spacesList = spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
for (var spaceId in spacesList) { for (var spaceId in spacesList) {
scenes.addAll( scenes.addAll(await SceneApi.getScenes(spaceId, communityId, projectUuid));
await SceneApi.getScenes(spaceId, communityId, projectUuid));
} }
} }
} else { } else {
scenes.addAll(await SceneApi.getScenes( scenes.addAll(await SceneApi.getScenes(
createRoutineBloc.selectedSpaceId, createRoutineBloc.selectedSpaceId, createRoutineBloc.selectedCommunityId, projectUuid));
createRoutineBloc.selectedCommunityId,
projectUuid));
} }
emit(state.copyWith( emit(state.copyWith(
@ -212,8 +199,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
Future<void> _onLoadAutomation( Future<void> _onLoadAutomation(LoadAutomation event, Emitter<RoutineState> emit) async {
LoadAutomation event, Emitter<RoutineState> emit) async {
emit(state.copyWith(isLoading: true, errorMessage: null)); emit(state.copyWith(isLoading: true, errorMessage: null));
List<ScenesModel> automations = []; List<ScenesModel> automations = [];
final projectId = await ProjectManager.getProjectUUID() ?? ''; final projectId = await ProjectManager.getProjectUUID() ?? '';
@ -221,23 +207,17 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
BuildContext context = NavigationService.navigatorKey.currentContext!; BuildContext context = NavigationService.navigatorKey.currentContext!;
var createRoutineBloc = context.read<CreateRoutineBloc>(); var createRoutineBloc = context.read<CreateRoutineBloc>();
try { try {
if (createRoutineBloc.selectedSpaceId == '' && createRoutineBloc.selectedCommunityId == '') {
if (createRoutineBloc.selectedSpaceId == '' &&
createRoutineBloc.selectedCommunityId == '') {
var spaceBloc = context.read<SpaceTreeBloc>(); var spaceBloc = context.read<SpaceTreeBloc>();
for (var communityId in spaceBloc.state.selectedCommunities) { for (var communityId in spaceBloc.state.selectedCommunities) {
List<String> spacesList = List<String> spacesList = spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
for (var spaceId in spacesList) { for (var spaceId in spacesList) {
automations.addAll( automations.addAll(await SceneApi.getAutomation(spaceId, communityId, projectId));
await SceneApi.getAutomation(spaceId, communityId, projectId));
} }
} }
} else { } else {
automations.addAll(await SceneApi.getAutomation( automations.addAll(await SceneApi.getAutomation(
createRoutineBloc.selectedSpaceId, createRoutineBloc.selectedSpaceId, createRoutineBloc.selectedCommunityId, projectId));
createRoutineBloc.selectedCommunityId,
projectId));
} }
emit(state.copyWith( emit(state.copyWith(
automations: automations, automations: automations,
@ -253,16 +233,14 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
FutureOr<void> _onSearchRoutines( FutureOr<void> _onSearchRoutines(SearchRoutines event, Emitter<RoutineState> emit) async {
SearchRoutines event, Emitter<RoutineState> emit) async {
emit(state.copyWith(isLoading: true, errorMessage: null)); emit(state.copyWith(isLoading: true, errorMessage: null));
await Future.delayed(const Duration(seconds: 1)); await Future.delayed(const Duration(seconds: 1));
emit(state.copyWith(isLoading: false, errorMessage: null)); emit(state.copyWith(isLoading: false, errorMessage: null));
emit(state.copyWith(searchText: event.query)); emit(state.copyWith(searchText: event.query));
} }
FutureOr<void> _onAddSelectedIcon( FutureOr<void> _onAddSelectedIcon(AddSelectedIcon event, Emitter<RoutineState> emit) {
AddSelectedIcon event, Emitter<RoutineState> emit) {
emit(state.copyWith(selectedIcon: event.icon)); emit(state.copyWith(selectedIcon: event.icon));
} }
@ -276,8 +254,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
return actions.last['deviceId'] == 'delay'; return actions.last['deviceId'] == 'delay';
} }
Future<void> _onCreateScene( Future<void> _onCreateScene(CreateSceneEvent event, Emitter<RoutineState> emit) async {
CreateSceneEvent event, Emitter<RoutineState> emit) async {
try { try {
// Check if first action is delay // Check if first action is delay
// if (_isFirstActionDelay(state.thenItems)) { // if (_isFirstActionDelay(state.thenItems)) {
@ -290,8 +267,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
if (_isLastActionDelay(state.thenItems)) { if (_isLastActionDelay(state.thenItems)) {
emit(state.copyWith( emit(state.copyWith(
errorMessage: errorMessage: 'A delay condition cannot be the only or the last action',
'A delay condition cannot be the only or the last action',
isLoading: false, isLoading: false,
)); ));
return; return;
@ -367,8 +343,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
Future<void> _onCreateAutomation( Future<void> _onCreateAutomation(CreateAutomationEvent event, Emitter<RoutineState> emit) async {
CreateAutomationEvent event, Emitter<RoutineState> emit) async {
try { try {
final projectUuid = await ProjectManager.getProjectUUID() ?? ''; final projectUuid = await ProjectManager.getProjectUUID() ?? '';
if (state.routineName == null || state.routineName!.isEmpty) { if (state.routineName == null || state.routineName!.isEmpty) {
@ -390,8 +365,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
if (_isLastActionDelay(state.thenItems)) { if (_isLastActionDelay(state.thenItems)) {
emit(state.copyWith( emit(state.copyWith(
errorMessage: errorMessage: 'A delay condition cannot be the only or the last action',
'A delay condition cannot be the only or the last action',
isLoading: false, isLoading: false,
)); ));
CustomSnackBar.redSnackBar('Cannot have delay as the last action'); CustomSnackBar.redSnackBar('Cannot have delay as the last action');
@ -482,8 +456,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
actions: actions, actions: actions,
); );
final result = final result = await SceneApi.createAutomation(createAutomationModel, projectUuid);
await SceneApi.createAutomation(createAutomationModel, projectUuid);
if (result['success']) { if (result['success']) {
add(ResetRoutineState()); add(ResetRoutineState());
add(const LoadAutomation()); add(const LoadAutomation());
@ -504,21 +477,17 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
FutureOr<void> _onRemoveDragCard( FutureOr<void> _onRemoveDragCard(RemoveDragCard event, Emitter<RoutineState> emit) {
RemoveDragCard event, Emitter<RoutineState> emit) {
if (event.isFromThen) { if (event.isFromThen) {
final thenItems = List<Map<String, dynamic>>.from(state.thenItems); final thenItems = List<Map<String, dynamic>>.from(state.thenItems);
final selectedFunctions = final selectedFunctions = Map<String, List<DeviceFunctionData>>.from(state.selectedFunctions);
Map<String, List<DeviceFunctionData>>.from(state.selectedFunctions);
thenItems.removeAt(event.index); thenItems.removeAt(event.index);
selectedFunctions.remove(event.key); selectedFunctions.remove(event.key);
emit(state.copyWith( emit(state.copyWith(thenItems: thenItems, selectedFunctions: selectedFunctions));
thenItems: thenItems, selectedFunctions: selectedFunctions));
} else { } else {
final ifItems = List<Map<String, dynamic>>.from(state.ifItems); final ifItems = List<Map<String, dynamic>>.from(state.ifItems);
final selectedFunctions = final selectedFunctions = Map<String, List<DeviceFunctionData>>.from(state.selectedFunctions);
Map<String, List<DeviceFunctionData>>.from(state.selectedFunctions);
ifItems.removeAt(event.index); ifItems.removeAt(event.index);
selectedFunctions.remove(event.key); selectedFunctions.remove(event.key);
@ -529,8 +498,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
isAutomation: false, isAutomation: false,
isTabToRun: false)); isTabToRun: false));
} else { } else {
emit(state.copyWith( emit(state.copyWith(ifItems: ifItems, selectedFunctions: selectedFunctions));
ifItems: ifItems, selectedFunctions: selectedFunctions));
} }
} }
} }
@ -542,141 +510,138 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
)); ));
} }
FutureOr<void> _onEffectiveTimeEvent( FutureOr<void> _onEffectiveTimeEvent(EffectiveTimePeriodEvent event, Emitter<RoutineState> emit) {
EffectiveTimePeriodEvent event, Emitter<RoutineState> emit) {
emit(state.copyWith(effectiveTime: event.effectiveTime)); emit(state.copyWith(effectiveTime: event.effectiveTime));
} }
FutureOr<void> _onSetRoutineName( FutureOr<void> _onSetRoutineName(SetRoutineName event, Emitter<RoutineState> emit) {
SetRoutineName event, Emitter<RoutineState> emit) {
emit(state.copyWith( emit(state.copyWith(
routineName: event.name, routineName: event.name,
)); ));
} }
( // (
List<Map<String, dynamic>>, // List<Map<String, dynamic>>,
List<Map<String, dynamic>>, // List<Map<String, dynamic>>,
Map<String, List<DeviceFunctionData>> // Map<String, List<DeviceFunctionData>>
) _createCardData( // ) _createCardData(
List<RoutineAction> actions, // List<RoutineAction> actions,
List<RoutineCondition>? conditions, // List<RoutineCondition>? conditions,
Map<String, List<DeviceFunctionData>> currentFunctions, // Map<String, List<DeviceFunctionData>> currentFunctions,
bool isTabToRun, // bool isTabToRun,
) { // ) {
final ifItems = isTabToRun // final ifItems = isTabToRun
? [ // ? [
{ // {
'entityId': 'tab_to_run', // 'entityId': 'tab_to_run',
'uniqueCustomId': const Uuid().v4(), // 'uniqueCustomId': const Uuid().v4(),
'deviceId': 'tab_to_run', // 'deviceId': 'tab_to_run',
'title': 'Tab to run', // 'title': 'Tab to run',
'productType': 'tab_to_run', // 'productType': 'tab_to_run',
'imagePath': Assets.tabToRun, // 'imagePath': Assets.tabToRun,
} // }
] // ]
: conditions?.map((condition) { // : conditions?.map((condition) {
final matchingDevice = state.devices.firstWhere( // final matchingDevice = state.devices.firstWhere(
(device) => device.uuid == condition.entityId, // (device) => device.uuid == condition.entityId,
orElse: () => AllDevicesModel( // orElse: () => AllDevicesModel(
uuid: condition.entityId, // uuid: condition.entityId,
name: condition.entityId, // name: condition.entityId,
productType: condition.entityType, // productType: condition.entityType,
), // ),
); // );
final cardData = { // final cardData = {
'entityId': condition.entityId, // 'entityId': condition.entityId,
'uniqueCustomId': const Uuid().v4(), // 'uniqueCustomId': const Uuid().v4(),
'deviceId': condition.entityId, // 'deviceId': condition.entityId,
'title': matchingDevice.name ?? condition.entityId, // 'title': matchingDevice.name ?? condition.entityId,
'productType': condition.entityType, // 'productType': condition.entityType,
'imagePath': // 'imagePath':
matchingDevice.getDefaultIcon(condition.entityType), // matchingDevice.getDefaultIcon(condition.entityType),
}; // };
final functions = matchingDevice.functions; // final functions = matchingDevice.functions;
for (var function in functions) { // for (var function in functions) {
if (function.code == condition.expr.statusCode) { // if (function.code == condition.expr.statusCode) {
currentFunctions[cardData['uniqueCustomId'] ?? ''] = [ // currentFunctions[cardData['uniqueCustomId'] ?? ''] = [
DeviceFunctionData( // DeviceFunctionData(
entityId: condition.entityId, // entityId: condition.entityId,
functionCode: condition.expr.statusCode, // functionCode: condition.expr.statusCode,
value: condition.expr.statusValue, // value: condition.expr.statusValue,
operationName: function.operationName, // operationName: function.operationName,
), // ),
]; // ];
break; // break;
} // }
} // }
return cardData; // return cardData;
}).toList() ?? // }).toList() ??
[]; // [];
final thenItems = actions.map((action) { // final thenItems = actions.map((action) {
final matchingDevice = state.devices.firstWhere( // final matchingDevice = state.devices.firstWhere(
(device) => device.uuid == action.entityId, // (device) => device.uuid == action.entityId,
orElse: () => AllDevicesModel( // orElse: () => AllDevicesModel(
uuid: action.entityId, // uuid: action.entityId,
name: action.entityId, // name: action.entityId,
productType: action.productType, // productType: action.productType,
), // ),
); // );
final cardData = { // final cardData = {
'entityId': action.entityId, // 'entityId': action.entityId,
'uniqueCustomId': const Uuid().v4(), // 'uniqueCustomId': const Uuid().v4(),
'deviceId': // 'deviceId':
action.actionExecutor == 'delay' ? 'delay' : action.entityId, // action.actionExecutor == 'delay' ? 'delay' : action.entityId,
'title': action.actionExecutor == 'delay' // 'title': action.actionExecutor == 'delay'
? 'Delay' // ? 'Delay'
: (matchingDevice.name ?? 'Device'), // : (matchingDevice.name ?? 'Device'),
'productType': action.productType, // 'productType': action.productType,
'imagePath': matchingDevice.getDefaultIcon(action.productType), // 'imagePath': matchingDevice.getDefaultIcon(action.productType),
}; // };
final functions = matchingDevice.functions; // final functions = matchingDevice.functions;
if (action.executorProperty != null && action.actionExecutor != 'delay') { // if (action.executorProperty != null && action.actionExecutor != 'delay') {
final functionCode = action.executorProperty!.functionCode; // final functionCode = action.executorProperty!.functionCode;
for (var function in functions) { // for (var function in functions) {
if (function.code == functionCode) { // if (function.code == functionCode) {
currentFunctions[cardData['uniqueCustomId'] ?? ''] = [ // currentFunctions[cardData['uniqueCustomId'] ?? ''] = [
DeviceFunctionData( // DeviceFunctionData(
entityId: action.entityId, // entityId: action.entityId,
functionCode: functionCode ?? '', // functionCode: functionCode ?? '',
value: action.executorProperty!.functionValue, // value: action.executorProperty!.functionValue,
operationName: function.operationName, // operationName: function.operationName,
), // ),
]; // ];
break; // break;
} // }
} // }
} else if (action.actionExecutor == 'delay') { // } else if (action.actionExecutor == 'delay') {
final delayFunction = DelayFunction( // final delayFunction = DelayFunction(
deviceId: action.entityId, // deviceId: action.entityId,
deviceName: 'Delay', // deviceName: 'Delay',
); // );
currentFunctions[cardData['uniqueCustomId'] ?? ''] = [ // currentFunctions[cardData['uniqueCustomId'] ?? ''] = [
DeviceFunctionData( // DeviceFunctionData(
entityId: action.entityId, // entityId: action.entityId,
functionCode: 'delay', // functionCode: 'delay',
value: action.executorProperty?.delaySeconds ?? 0, // value: action.executorProperty?.delaySeconds ?? 0,
operationName: delayFunction.operationName, // operationName: delayFunction.operationName,
), // ),
]; // ];
} // }
return cardData; // return cardData;
}).toList(); // }).toList();
return (thenItems, ifItems, currentFunctions); // return (thenItems, ifItems, currentFunctions);
} // }
Future<void> _onGetSceneDetails( Future<void> _onGetSceneDetails(GetSceneDetails event, Emitter<RoutineState> emit) async {
GetSceneDetails event, Emitter<RoutineState> emit) async {
try { try {
emit(state.copyWith( emit(state.copyWith(
isLoading: true, isLoading: true,
@ -724,10 +689,8 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
if (!deviceCards.containsKey(deviceId)) { if (!deviceCards.containsKey(deviceId)) {
deviceCards[deviceId] = { deviceCards[deviceId] = {
'entityId': action.entityId, 'entityId': action.entityId,
'deviceId': 'deviceId': action.actionExecutor == 'delay' ? 'delay' : action.entityId,
action.actionExecutor == 'delay' ? 'delay' : action.entityId, 'uniqueCustomId': action.type == 'automation' || action.actionExecutor == 'delay'
'uniqueCustomId':
action.type == 'automation' || action.actionExecutor == 'delay'
? const Uuid().v4() ? const Uuid().v4()
: action.entityId, : action.entityId,
'title': action.actionExecutor == 'delay' 'title': action.actionExecutor == 'delay'
@ -764,16 +727,15 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
), ),
); );
// emit(state.copyWith(automationActionExecutor: action.actionExecutor)); // emit(state.copyWith(automationActionExecutor: action.actionExecutor));
} else if (action.executorProperty != null && } else if (action.executorProperty != null && action.actionExecutor != 'delay') {
action.actionExecutor != 'delay') { // if (!updatedFunctions.containsKey(uniqueCustomId)) {
if (!updatedFunctions.containsKey(uniqueCustomId)) { // updatedFunctions[uniqueCustomId] = [];
updatedFunctions[uniqueCustomId] = []; // }
}
final functions = matchingDevice?.functions; final functions = matchingDevice?.functions;
final functionCode = action.executorProperty?.functionCode; final functionCode = action.executorProperty?.functionCode;
for (DeviceFunction function in functions ?? []) { for (DeviceFunction function in functions ?? []) {
if (function.code == functionCode) { if (function.code == functionCode) {
updatedFunctions[uniqueCustomId]!.add( updatedFunctions[const Uuid().v4()]!.add(
DeviceFunctionData( DeviceFunctionData(
entityId: action.entityId, entityId: action.entityId,
functionCode: functionCode ?? '', functionCode: functionCode ?? '',
@ -837,8 +799,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
FutureOr<void> _onResetRoutineState( FutureOr<void> _onResetRoutineState(ResetRoutineState event, Emitter<RoutineState> emit) {
ResetRoutineState event, Emitter<RoutineState> emit) {
emit(state.copyWith( emit(state.copyWith(
ifItems: [], ifItems: [],
thenItems: [], thenItems: [],
@ -861,6 +822,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
isUpdate: false, isUpdate: false,
createRoutineView: false)); createRoutineView: false));
} }
FutureOr<void> _deleteScene(DeleteScene event, Emitter<RoutineState> emit) async { FutureOr<void> _deleteScene(DeleteScene event, Emitter<RoutineState> emit) async {
try { try {
final projectId = await ProjectManager.getProjectUUID() ?? ''; final projectId = await ProjectManager.getProjectUUID() ?? '';
@ -915,8 +877,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
// } // }
// } // }
FutureOr<void> _fetchDevices( FutureOr<void> _fetchDevices(FetchDevicesInRoutine event, Emitter<RoutineState> emit) async {
FetchDevicesInRoutine event, Emitter<RoutineState> emit) async {
emit(state.copyWith(isLoading: true)); emit(state.copyWith(isLoading: true));
try { try {
final projectUuid = await ProjectManager.getProjectUUID() ?? ''; final projectUuid = await ProjectManager.getProjectUUID() ?? '';
@ -925,21 +886,17 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
var createRoutineBloc = context.read<CreateRoutineBloc>(); var createRoutineBloc = context.read<CreateRoutineBloc>();
var spaceBloc = context.read<SpaceTreeBloc>(); var spaceBloc = context.read<SpaceTreeBloc>();
if (createRoutineBloc.selectedSpaceId == '' && if (createRoutineBloc.selectedSpaceId == '' && createRoutineBloc.selectedCommunityId == '') {
createRoutineBloc.selectedCommunityId == '') {
for (var communityId in spaceBloc.state.selectedCommunities) { for (var communityId in spaceBloc.state.selectedCommunities) {
List<String> spacesList = List<String> spacesList = spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
spaceBloc.state.selectedCommunityAndSpaces[communityId] ?? [];
for (var spaceId in spacesList) { for (var spaceId in spacesList) {
devices.addAll(await DevicesManagementApi() devices.addAll(
.fetchDevices(communityId, spaceId, projectUuid)); await DevicesManagementApi().fetchDevices(communityId, spaceId, projectUuid));
} }
} }
} else { } else {
devices.addAll(await DevicesManagementApi().fetchDevices( devices.addAll(await DevicesManagementApi().fetchDevices(
createRoutineBloc.selectedCommunityId, createRoutineBloc.selectedCommunityId, createRoutineBloc.selectedSpaceId, projectUuid));
createRoutineBloc.selectedSpaceId,
projectUuid));
} }
emit(state.copyWith(isLoading: false, devices: devices)); emit(state.copyWith(isLoading: false, devices: devices));
@ -948,8 +905,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
FutureOr<void> _onUpdateScene( FutureOr<void> _onUpdateScene(UpdateScene event, Emitter<RoutineState> emit) async {
UpdateScene event, Emitter<RoutineState> emit) async {
try { try {
// Check if first action is delay // Check if first action is delay
// if (_isFirstActionDelay(state.thenItems)) { // if (_isFirstActionDelay(state.thenItems)) {
@ -963,8 +919,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
if (_isLastActionDelay(state.thenItems)) { if (_isLastActionDelay(state.thenItems)) {
emit(state.copyWith( emit(state.copyWith(
errorMessage: errorMessage: 'A delay condition cannot be the only or the last action',
'A delay condition cannot be the only or the last action',
isLoading: false, isLoading: false,
)); ));
return; return;
@ -1017,8 +972,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
actions: actions, actions: actions,
); );
final result = final result = await SceneApi.updateScene(createSceneModel, state.sceneId ?? '');
await SceneApi.updateScene(createSceneModel, state.sceneId ?? '');
if (result['success']) { if (result['success']) {
add(ResetRoutineState()); add(ResetRoutineState());
add(const LoadScenes()); add(const LoadScenes());
@ -1037,8 +991,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
FutureOr<void> _onUpdateAutomation( FutureOr<void> _onUpdateAutomation(UpdateAutomation event, Emitter<RoutineState> emit) async {
UpdateAutomation event, Emitter<RoutineState> emit) async {
try { try {
if (state.routineName == null || state.routineName!.isEmpty) { if (state.routineName == null || state.routineName!.isEmpty) {
emit(state.copyWith( emit(state.copyWith(
@ -1253,15 +1206,13 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
), ),
); );
final deviceId = action.actionExecutor == 'delay' final deviceId =
? '${action.entityId}_delay' action.actionExecutor == 'delay' ? '${action.entityId}_delay' : action.entityId;
: action.entityId;
if (!deviceThenCards.containsKey(deviceId)) { if (!deviceThenCards.containsKey(deviceId)) {
deviceThenCards[deviceId] = { deviceThenCards[deviceId] = {
'entityId': action.entityId, 'entityId': action.entityId,
'deviceId': 'deviceId': action.actionExecutor == 'delay' ? 'delay' : action.entityId,
action.actionExecutor == 'delay' ? 'delay' : action.entityId,
'uniqueCustomId': const Uuid().v4(), 'uniqueCustomId': const Uuid().v4(),
'title': action.actionExecutor == 'delay' 'title': action.actionExecutor == 'delay'
? 'Delay' ? 'Delay'
@ -1281,7 +1232,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
: action.type == 'automation' : action.type == 'automation'
? 'automation' ? 'automation'
: 'action', : 'action',
'icon': action.icon ?? '' 'icon': action.icon ?? '',
}; };
} }
@ -1292,8 +1243,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
updatedFunctions[uniqueCustomId] = []; updatedFunctions[uniqueCustomId] = [];
} }
if (action.executorProperty != null && if (action.executorProperty != null && action.actionExecutor != 'delay') {
action.actionExecutor != 'delay') {
final functions = matchingDevice.functions; final functions = matchingDevice.functions;
final functionCode = action.executorProperty!.functionCode; final functionCode = action.executorProperty!.functionCode;
for (var function in functions) { for (var function in functions) {
@ -1335,14 +1285,10 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
final ifItems = deviceIfCards.values final ifItems = deviceIfCards.values.where((card) => card['type'] == 'condition').toList();
.where((card) => card['type'] == 'condition')
.toList();
final thenItems = deviceThenCards.values final thenItems = deviceThenCards.values
.where((card) => .where((card) =>
card['type'] == 'action' || card['type'] == 'action' || card['type'] == 'automation' || card['type'] == 'scene')
card['type'] == 'automation' ||
card['type'] == 'scene')
.toList(); .toList();
emit(state.copyWith( emit(state.copyWith(
@ -1364,8 +1310,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
} }
} }
Future<void> _onSceneTrigger( Future<void> _onSceneTrigger(SceneTrigger event, Emitter<RoutineState> emit) async {
SceneTrigger event, Emitter<RoutineState> emit) async {
emit(state.copyWith(loadingSceneId: event.sceneId)); emit(state.copyWith(loadingSceneId: event.sceneId));
try { try {
@ -1407,29 +1352,24 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
if (success) { if (success) {
final updatedAutomations = await SceneApi.getAutomationByUnitId( final updatedAutomations = await SceneApi.getAutomationByUnitId(
event.automationStatusUpdate.spaceUuid, event.automationStatusUpdate.spaceUuid, event.communityId, projectId);
event.communityId,
projectId);
// Remove from loading set safely // Remove from loading set safely
final updatedLoadingIds = {...state.loadingAutomationIds!} final updatedLoadingIds = {...state.loadingAutomationIds!}..remove(event.automationId);
..remove(event.automationId);
emit(state.copyWith( emit(state.copyWith(
automations: updatedAutomations, automations: updatedAutomations,
loadingAutomationIds: updatedLoadingIds, loadingAutomationIds: updatedLoadingIds,
)); ));
} else { } else {
final updatedLoadingIds = {...state.loadingAutomationIds!} final updatedLoadingIds = {...state.loadingAutomationIds!}..remove(event.automationId);
..remove(event.automationId);
emit(state.copyWith( emit(state.copyWith(
loadingAutomationIds: updatedLoadingIds, loadingAutomationIds: updatedLoadingIds,
errorMessage: 'Update failed', errorMessage: 'Update failed',
)); ));
} }
} catch (e) { } catch (e) {
final updatedLoadingIds = {...state.loadingAutomationIds!} final updatedLoadingIds = {...state.loadingAutomationIds!}..remove(event.automationId);
..remove(event.automationId);
emit(state.copyWith( emit(state.copyWith(
loadingAutomationIds: updatedLoadingIds, loadingAutomationIds: updatedLoadingIds,
errorMessage: 'Update error: ${e.toString()}', errorMessage: 'Update error: ${e.toString()}',

View File

@ -6,6 +6,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart'; import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart';
import 'package:syncrow_web/pages/routines/models/device_functions.dart'; import 'package:syncrow_web/pages/routines/models/device_functions.dart';
import 'package:syncrow_web/utils/color_manager.dart'; import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/constants/assets.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart'; import 'package:syncrow_web/utils/extension/build_context_x.dart';
class DraggableCard extends StatelessWidget { class DraggableCard extends StatelessWidget {
@ -70,7 +71,7 @@ class DraggableCard extends StatelessWidget {
child: Container( child: Container(
padding: padding ?? const EdgeInsets.all(16), padding: padding ?? const EdgeInsets.all(16),
width: 110, width: 110,
height: deviceFunctions.isEmpty ? 123 : null, height: deviceFunctions.isEmpty ? 160 : 170,
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
@ -78,6 +79,7 @@ class DraggableCard extends StatelessWidget {
children: [ children: [
Column( Column(
mainAxisAlignment: MainAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [ children: [
Container( Container(
height: 50, height: 50,
@ -101,6 +103,7 @@ class DraggableCard extends StatelessWidget {
const SizedBox(height: 8), const SizedBox(height: 8),
Padding( Padding(
padding: const EdgeInsets.symmetric(horizontal: 3), padding: const EdgeInsets.symmetric(horizontal: 3),
child: Flexible(
child: Text( child: Text(
deviceData['title'] ?? deviceData['name'] ?? title, deviceData['title'] ?? deviceData['name'] ?? title,
textAlign: TextAlign.center, textAlign: TextAlign.center,
@ -112,8 +115,70 @@ class DraggableCard extends StatelessWidget {
), ),
), ),
), ),
),
const SizedBox(
height: 4,
),
Visibility(
visible: deviceData['tag'] != null && deviceData['tag'] != '',
child: Row(
spacing: 2,
children: [
SizedBox(
width: 8, height: 8, child: SvgPicture.asset(Assets.deviceTagIcon)),
Flexible(
child: Text(
deviceData['tag'] ?? '',
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: context.textTheme.bodySmall?.copyWith(
color: ColorsManager.lightGreyColor,
fontSize: 9,
fontWeight: FontWeight.w400,
),
),
),
], ],
), ),
),
Visibility(
visible: deviceData['subSpace'] != null && deviceData['subSpace'] != '',
child: const SizedBox(
height: 4,
),
),
Visibility(
visible: deviceData['subSpace'] != null && deviceData['subSpace'] != '',
child: Row(
spacing: 2,
children: [
SizedBox(
width: 8,
height: 8,
child: SvgPicture.asset(Assets.spaceLocationIcon)),
Flexible(
child: Text(
deviceData['subSpace'] ?? '',
textAlign: TextAlign.center,
overflow: TextOverflow.ellipsis,
maxLines: 2,
style: context.textTheme.bodySmall?.copyWith(
color: ColorsManager.lightGreyColor,
fontSize: 9,
fontWeight: FontWeight.w400,
),
),
),
],
),
),
],
),
if (deviceFunctions.isNotEmpty)
const SizedBox(
height: 4,
),
if (deviceFunctions.isNotEmpty) if (deviceFunctions.isNotEmpty)
...deviceFunctions.map((function) => Row( ...deviceFunctions.map((function) => Row(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
@ -123,7 +188,7 @@ class DraggableCard extends StatelessWidget {
'${function.operationName}: ${_formatFunctionValue(function)}', '${function.operationName}: ${_formatFunctionValue(function)}',
style: context.textTheme.bodySmall?.copyWith( style: context.textTheme.bodySmall?.copyWith(
fontSize: 9, fontSize: 9,
color: ColorsManager.textGray, color: ColorsManager.lightGreyColor,
height: 1.2, height: 1.2,
), ),
maxLines: 2, maxLines: 2,

View File

@ -51,12 +51,12 @@ class _RoutineDevicesState extends State<RoutineDevices> {
'productType': device.productType, 'productType': device.productType,
'functions': device.functions, 'functions': device.functions,
'uniqueCustomId': '', 'uniqueCustomId': '',
'tag': device.deviceTags!.isNotEmpty ? device.deviceTags![0].name : '',
'subSpace': device.deviceSubSpace?.subspaceName ?? '',
}; };
if (state.searchText != null && state.searchText!.isNotEmpty) { if (state.searchText != null && state.searchText!.isNotEmpty) {
return device.name! return device.name!.toLowerCase().contains(state.searchText!.toLowerCase())
.toLowerCase()
.contains(state.searchText!.toLowerCase())
? DraggableCard( ? DraggableCard(
imagePath: deviceData['imagePath'] as String, imagePath: deviceData['imagePath'] as String,
title: deviceData['title'] as String, title: deviceData['title'] as String,

View File

@ -5,7 +5,6 @@ import 'package:syncrow_web/pages/device_managment/all_devices/models/devices_mo
import 'package:syncrow_web/pages/routines/bloc/functions_bloc/functions_bloc_bloc.dart'; import 'package:syncrow_web/pages/routines/bloc/functions_bloc/functions_bloc_bloc.dart';
import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart'; import 'package:syncrow_web/pages/routines/bloc/routine_bloc/routine_bloc.dart';
import 'package:syncrow_web/pages/routines/helper/duration_format_helper.dart'; import 'package:syncrow_web/pages/routines/helper/duration_format_helper.dart';
import 'package:syncrow_web/pages/routines/models/ac/ac_function.dart';
import 'package:syncrow_web/pages/routines/models/device_functions.dart'; import 'package:syncrow_web/pages/routines/models/device_functions.dart';
import 'package:syncrow_web/pages/routines/models/gang_switches/base_switch_function.dart'; import 'package:syncrow_web/pages/routines/models/gang_switches/base_switch_function.dart';
import 'package:syncrow_web/pages/routines/models/gang_switches/one_gang_switch/one_gang_switch.dart'; import 'package:syncrow_web/pages/routines/models/gang_switches/one_gang_switch/one_gang_switch.dart';
@ -25,23 +24,21 @@ class OneGangSwitchHelper {
required String uniqueCustomId, required String uniqueCustomId,
required bool removeComparetors, required bool removeComparetors,
}) async { }) async {
List<BaseSwitchFunction> oneGangFunctions = List<BaseSwitchFunction> oneGangFunctions = functions.whereType<BaseSwitchFunction>().toList();
functions.whereType<BaseSwitchFunction>().toList();
return showDialog<Map<String, dynamic>?>( return showDialog<Map<String, dynamic>?>(
context: context, context: context,
builder: (BuildContext context) { builder: (BuildContext context) {
return BlocProvider( return BlocProvider(
create: (_) => FunctionBloc() create: (_) => FunctionBloc()..add(InitializeFunctions(deviceSelectedFunctions ?? [])),
..add(InitializeFunctions(deviceSelectedFunctions ?? [])),
child: AlertDialog( child: AlertDialog(
contentPadding: EdgeInsets.zero, contentPadding: EdgeInsets.zero,
content: BlocBuilder<FunctionBloc, FunctionBlocState>( content: BlocBuilder<FunctionBloc, FunctionBlocState>(
builder: (context, state) { builder: (context, state) {
final selectedFunction = state.selectedFunction; final selectedFunction = state.selectedFunction;
final selectedOperationName = state.selectedOperationName; final selectedOperationName = state.selectedOperationName;
final selectedFunctionData = state.addedFunctions final selectedFunctionData =
.firstWhere((f) => f.functionCode == selectedFunction, state.addedFunctions.firstWhere((f) => f.functionCode == selectedFunction,
orElse: () => DeviceFunctionData( orElse: () => DeviceFunctionData(
entityId: '', entityId: '',
functionCode: selectedFunction ?? '', functionCode: selectedFunction ?? '',
@ -88,12 +85,9 @@ class OneGangSwitchHelper {
color: ColorsManager.textGray, color: ColorsManager.textGray,
), ),
onTap: () { onTap: () {
context context.read<FunctionBloc>().add(SelectFunction(
.read<FunctionBloc>()
.add(SelectFunction(
functionCode: function.code, functionCode: function.code,
operationName: operationName: function.operationName,
function.operationName,
)); ));
}, },
); );
@ -226,11 +220,11 @@ class OneGangSwitchHelper {
selectedFunctionData, selectedFunctionData,
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
_buildCountDownDisplay(context, initialValue, device, operationName, _buildCountDownDisplay(
selectedFunctionData, selectCode), context, initialValue, device, operationName, selectedFunctionData, selectCode),
const SizedBox(height: 20), const SizedBox(height: 20),
_buildCountDownSlider(context, initialValue, device, operationName, _buildCountDownSlider(
selectedFunctionData, selectCode), context, initialValue, device, operationName, selectedFunctionData, selectCode),
], ],
); );
} }
@ -271,8 +265,7 @@ class OneGangSwitchHelper {
minHeight: 40.0, minHeight: 40.0,
minWidth: 40.0, minWidth: 40.0,
), ),
isSelected: isSelected: conditions.map((c) => c == (currentCondition ?? "==")).toList(),
conditions.map((c) => c == (currentCondition ?? "==")).toList(),
children: conditions.map((c) => Text(c)).toList(), children: conditions.map((c) => Text(c)).toList(),
); );
} }
@ -320,8 +313,7 @@ class OneGangSwitchHelper {
value: (initialValue ?? 0).toDouble(), value: (initialValue ?? 0).toDouble(),
min: operationalValues.minValue?.toDouble() ?? 0.0, min: operationalValues.minValue?.toDouble() ?? 0.0,
max: operationalValues.maxValue?.toDouble() ?? 0.0, max: operationalValues.maxValue?.toDouble() ?? 0.0,
divisions: (((operationalValues.maxValue ?? 0) - divisions: (((operationalValues.maxValue ?? 0) - (operationalValues.minValue ?? 0)) /
(operationalValues.minValue ?? 0)) /
(operationalValues.stepValue ?? 1)) (operationalValues.stepValue ?? 1))
.round(), .round(),
onChanged: (value) { onChanged: (value) {
@ -373,13 +365,9 @@ class OneGangSwitchHelper {
style: context.textTheme.bodyMedium, style: context.textTheme.bodyMedium,
), ),
trailing: Icon( trailing: Icon(
isSelected isSelected ? Icons.radio_button_checked : Icons.radio_button_unchecked,
? Icons.radio_button_checked
: Icons.radio_button_unchecked,
size: 24, size: 24,
color: isSelected color: isSelected ? ColorsManager.primaryColorWithOpacity : ColorsManager.textGray,
? ColorsManager.primaryColorWithOpacity
: ColorsManager.textGray,
), ),
onTap: () { onTap: () {
if (!isSelected) { if (!isSelected) {
@ -391,8 +379,7 @@ class OneGangSwitchHelper {
operationName: operationName, operationName: operationName,
value: value.value, value: value.value,
condition: selectedFunctionData?.condition, condition: selectedFunctionData?.condition,
valueDescription: valueDescription: selectedFunctionData?.valueDescription,
selectedFunctionData?.valueDescription,
), ),
), ),
); );

View File

@ -13,8 +13,7 @@ class Assets {
static const String rightLine = "assets/images/right_line.png"; static const String rightLine = "assets/images/right_line.png";
static const String google = "assets/images/google.svg"; static const String google = "assets/images/google.svg";
static const String facebook = "assets/images/facebook.svg"; static const String facebook = "assets/images/facebook.svg";
static const String invisiblePassword = static const String invisiblePassword = "assets/images/Password_invisible.svg";
"assets/images/Password_invisible.svg";
static const String visiblePassword = "assets/images/password_visible.svg"; static const String visiblePassword = "assets/images/password_visible.svg";
static const String accessIcon = "assets/images/access_icon.svg"; static const String accessIcon = "assets/images/access_icon.svg";
static const String spaseManagementIcon = static const String spaseManagementIcon =
@ -31,8 +30,7 @@ class Assets {
static const String emptyTable = "assets/images/empty_table.svg"; static const String emptyTable = "assets/images/empty_table.svg";
// General assets // General assets
static const String motionlessDetection = static const String motionlessDetection = "assets/icons/motionless_detection.svg";
"assets/icons/motionless_detection.svg";
static const String acHeating = "assets/icons/ac_heating.svg"; static const String acHeating = "assets/icons/ac_heating.svg";
static const String acPowerOff = "assets/icons/ac_power_off.svg"; static const String acPowerOff = "assets/icons/ac_power_off.svg";
static const String acFanMiddle = "assets/icons/ac_fan_middle.svg"; static const String acFanMiddle = "assets/icons/ac_fan_middle.svg";
@ -69,22 +67,19 @@ class Assets {
"assets/icons/automation_functions/temp_password_unlock.svg"; "assets/icons/automation_functions/temp_password_unlock.svg";
static const String doorlockNormalOpen = static const String doorlockNormalOpen =
"assets/icons/automation_functions/doorlock_normal_open.svg"; "assets/icons/automation_functions/doorlock_normal_open.svg";
static const String doorbell = static const String doorbell = "assets/icons/automation_functions/doorbell.svg";
"assets/icons/automation_functions/doorbell.svg";
static const String remoteUnlockViaApp = static const String remoteUnlockViaApp =
"assets/icons/automation_functions/remote_unlock_via_app.svg"; "assets/icons/automation_functions/remote_unlock_via_app.svg";
static const String doubleLock = static const String doubleLock =
"assets/icons/automation_functions/double_lock.svg"; "assets/icons/automation_functions/double_lock.svg";
static const String selfTestResult = static const String selfTestResult =
"assets/icons/automation_functions/self_test_result.svg"; "assets/icons/automation_functions/self_test_result.svg";
static const String lockAlarm = static const String lockAlarm = "assets/icons/automation_functions/lock_alarm.svg";
"assets/icons/automation_functions/lock_alarm.svg";
static const String presenceState = static const String presenceState =
"assets/icons/automation_functions/presence_state.svg"; "assets/icons/automation_functions/presence_state.svg";
static const String currentTemp = static const String currentTemp =
"assets/icons/automation_functions/current_temp.svg"; "assets/icons/automation_functions/current_temp.svg";
static const String presence = static const String presence = "assets/icons/automation_functions/presence.svg";
"assets/icons/automation_functions/presence.svg";
static const String residualElectricity = static const String residualElectricity =
"assets/icons/automation_functions/residual_electricity.svg"; "assets/icons/automation_functions/residual_electricity.svg";
static const String hijackAlarm = static const String hijackAlarm =
@ -101,15 +96,12 @@ class Assets {
// Presence Sensor Assets // Presence Sensor Assets
static const String sensorMotionIcon = "assets/icons/sensor_motion_ic.svg"; static const String sensorMotionIcon = "assets/icons/sensor_motion_ic.svg";
static const String sensorPresenceIcon = static const String sensorPresenceIcon = "assets/icons/sensor_presence_ic.svg";
"assets/icons/sensor_presence_ic.svg";
static const String sensorVacantIcon = "assets/icons/sensor_vacant_ic.svg"; static const String sensorVacantIcon = "assets/icons/sensor_vacant_ic.svg";
static const String illuminanceRecordIcon = static const String illuminanceRecordIcon =
"assets/icons/illuminance_record_ic.svg"; "assets/icons/illuminance_record_ic.svg";
static const String presenceRecordIcon = static const String presenceRecordIcon = "assets/icons/presence_record_ic.svg";
"assets/icons/presence_record_ic.svg"; static const String helpDescriptionIcon = "assets/icons/help_description_ic.svg";
static const String helpDescriptionIcon =
"assets/icons/help_description_ic.svg";
static const String lightPulp = "assets/icons/light_pulb.svg"; static const String lightPulp = "assets/icons/light_pulb.svg";
static const String acDevice = "assets/icons/ac_device.svg"; static const String acDevice = "assets/icons/ac_device.svg";
@ -159,12 +151,10 @@ class Assets {
static const String unit = 'assets/icons/unit_icon.svg'; static const String unit = 'assets/icons/unit_icon.svg';
static const String villa = 'assets/icons/villa_icon.svg'; static const String villa = 'assets/icons/villa_icon.svg';
static const String iconEdit = 'assets/icons/icon_edit_icon.svg'; static const String iconEdit = 'assets/icons/icon_edit_icon.svg';
static const String textFieldSearch = static const String textFieldSearch = 'assets/icons/textfield_search_icon.svg';
'assets/icons/textfield_search_icon.svg';
static const String roundedAddIcon = 'assets/icons/rounded_add_icon.svg'; static const String roundedAddIcon = 'assets/icons/rounded_add_icon.svg';
static const String addIcon = 'assets/icons/add_icon.svg'; static const String addIcon = 'assets/icons/add_icon.svg';
static const String smartThermostatIcon = static const String smartThermostatIcon = 'assets/icons/smart_thermostat_icon.svg';
'assets/icons/smart_thermostat_icon.svg';
static const String smartLightIcon = 'assets/icons/smart_light_icon.svg'; static const String smartLightIcon = 'assets/icons/smart_light_icon.svg';
static const String presenceSensor = 'assets/icons/presence_sensor.svg'; static const String presenceSensor = 'assets/icons/presence_sensor.svg';
static const String Gang3SwitchIcon = 'assets/icons/3_Gang_switch_icon.svg'; static const String Gang3SwitchIcon = 'assets/icons/3_Gang_switch_icon.svg';
@ -212,8 +202,7 @@ class Assets {
//assets/icons/water_leak_normal.svg //assets/icons/water_leak_normal.svg
static const String waterLeakNormal = 'assets/icons/water_leak_normal.svg'; static const String waterLeakNormal = 'assets/icons/water_leak_normal.svg';
//assets/icons/water_leak_detected.svg //assets/icons/water_leak_detected.svg
static const String waterLeakDetected = static const String waterLeakDetected = 'assets/icons/water_leak_detected.svg';
'assets/icons/water_leak_detected.svg';
//assets/icons/automation_records.svg //assets/icons/automation_records.svg
static const String automationRecords = 'assets/icons/automation_records.svg'; static const String automationRecords = 'assets/icons/automation_records.svg';
@ -284,16 +273,13 @@ class Assets {
"assets/icons/functions_icons/sensitivity.svg"; "assets/icons/functions_icons/sensitivity.svg";
static const String assetsSensitivityOperationIcon = static const String assetsSensitivityOperationIcon =
"assets/icons/functions_icons/sesitivity_operation_icon.svg"; "assets/icons/functions_icons/sesitivity_operation_icon.svg";
static const String assetsAcPower = static const String assetsAcPower = "assets/icons/functions_icons/ac_power.svg";
"assets/icons/functions_icons/ac_power.svg";
static const String assetsAcPowerOFF = static const String assetsAcPowerOFF =
"assets/icons/functions_icons/ac_power_off.svg"; "assets/icons/functions_icons/ac_power_off.svg";
static const String assetsChildLock = static const String assetsChildLock =
"assets/icons/functions_icons/child_lock.svg"; "assets/icons/functions_icons/child_lock.svg";
static const String assetsFreezing = static const String assetsFreezing = "assets/icons/functions_icons/freezing.svg";
"assets/icons/functions_icons/freezing.svg"; static const String assetsFanSpeed = "assets/icons/functions_icons/fan_speed.svg";
static const String assetsFanSpeed =
"assets/icons/functions_icons/fan_speed.svg";
static const String assetsAcCooling = static const String assetsAcCooling =
"assets/icons/functions_icons/ac_cooling.svg"; "assets/icons/functions_icons/ac_cooling.svg";
static const String assetsAcHeating = static const String assetsAcHeating =
@ -302,8 +288,7 @@ class Assets {
"assets/icons/functions_icons/celsius_degrees.svg"; "assets/icons/functions_icons/celsius_degrees.svg";
static const String assetsTempreture = static const String assetsTempreture =
"assets/icons/functions_icons/tempreture.svg"; "assets/icons/functions_icons/tempreture.svg";
static const String assetsAcFanLow = static const String assetsAcFanLow = "assets/icons/functions_icons/ac_fan_low.svg";
"assets/icons/functions_icons/ac_fan_low.svg";
static const String assetsAcFanMiddle = static const String assetsAcFanMiddle =
"assets/icons/functions_icons/ac_fan_middle.svg"; "assets/icons/functions_icons/ac_fan_middle.svg";
static const String assetsAcFanHigh = static const String assetsAcFanHigh =
@ -322,8 +307,7 @@ class Assets {
"assets/icons/functions_icons/far_detection.svg"; "assets/icons/functions_icons/far_detection.svg";
static const String assetsFarDetectionFunction = static const String assetsFarDetectionFunction =
"assets/icons/functions_icons/far_detection_function.svg"; "assets/icons/functions_icons/far_detection_function.svg";
static const String assetsIndicator = static const String assetsIndicator = "assets/icons/functions_icons/indicator.svg";
"assets/icons/functions_icons/indicator.svg";
static const String assetsMotionDetection = static const String assetsMotionDetection =
"assets/icons/functions_icons/motion_detection.svg"; "assets/icons/functions_icons/motion_detection.svg";
static const String assetsMotionlessDetection = static const String assetsMotionlessDetection =
@ -336,8 +320,7 @@ class Assets {
"assets/icons/functions_icons/master_state.svg"; "assets/icons/functions_icons/master_state.svg";
static const String assetsSwitchAlarmSound = static const String assetsSwitchAlarmSound =
"assets/icons/functions_icons/switch_alarm_sound.svg"; "assets/icons/functions_icons/switch_alarm_sound.svg";
static const String assetsResetOff = static const String assetsResetOff = "assets/icons/functions_icons/reset_off.svg";
"assets/icons/functions_icons/reset_off.svg";
// Assets for automation_functions // Assets for automation_functions
static const String assetsCardUnlock = static const String assetsCardUnlock =
@ -381,14 +364,12 @@ class Assets {
static const String activeUser = 'assets/icons/active_user.svg'; static const String activeUser = 'assets/icons/active_user.svg';
static const String deActiveUser = 'assets/icons/deactive_user.svg'; static const String deActiveUser = 'assets/icons/deactive_user.svg';
static const String invitedIcon = 'assets/icons/invited_icon.svg'; static const String invitedIcon = 'assets/icons/invited_icon.svg';
static const String rectangleCheckBox = static const String rectangleCheckBox = 'assets/icons/rectangle_check_box.png';
'assets/icons/rectangle_check_box.png';
static const String CheckBoxChecked = 'assets/icons/box_checked.png'; static const String CheckBoxChecked = 'assets/icons/box_checked.png';
static const String emptyBox = 'assets/icons/empty_box.png'; static const String emptyBox = 'assets/icons/empty_box.png';
static const String completeProcessIcon = static const String completeProcessIcon =
'assets/icons/compleate_process_icon.svg'; 'assets/icons/compleate_process_icon.svg';
static const String currentProcessIcon = static const String currentProcessIcon = 'assets/icons/current_process_icon.svg';
'assets/icons/current_process_icon.svg';
static const String uncomplete_ProcessIcon = static const String uncomplete_ProcessIcon =
'assets/icons/uncompleate_process_icon.svg'; 'assets/icons/uncompleate_process_icon.svg';
static const String wrongProcessIcon = 'assets/icons/wrong_process_icon.svg'; static const String wrongProcessIcon = 'assets/icons/wrong_process_icon.svg';
@ -409,11 +390,9 @@ class Assets {
static const String successIcon = 'assets/icons/success_icon.svg'; static const String successIcon = 'assets/icons/success_icon.svg';
static const String spaceLocationIcon = 'assets/icons/spaseLocationIcon.svg'; static const String spaceLocationIcon = 'assets/icons/spaseLocationIcon.svg';
static const String scenesPlayIcon = 'assets/icons/scenesPlayIcon.png'; static const String scenesPlayIcon = 'assets/icons/scenesPlayIcon.png';
static const String scenesPlayIconCheck = static const String scenesPlayIconCheck = 'assets/icons/scenesPlayIconCheck.png';
'assets/icons/scenesPlayIconCheck.png';
static const String presenceStateIcon = 'assets/icons/presence_state.svg'; static const String presenceStateIcon = 'assets/icons/presence_state.svg';
static const String currentDistanceIcon = static const String currentDistanceIcon = 'assets/icons/current_distance_icon.svg';
'assets/icons/current_distance_icon.svg';
static const String farDetectionIcon = 'assets/icons/far_detection_icon.svg'; static const String farDetectionIcon = 'assets/icons/far_detection_icon.svg';
static const String motionDetectionSensitivityIcon = static const String motionDetectionSensitivityIcon =
@ -423,7 +402,8 @@ class Assets {
'assets/icons/motionless_detection_sensitivity_icon.svg'; 'assets/icons/motionless_detection_sensitivity_icon.svg';
static const String IndicatorIcon = 'assets/icons/Indicator_icon.svg'; static const String IndicatorIcon = 'assets/icons/Indicator_icon.svg';
static const String motionDetectionSensitivityValueIcon = 'assets/icons/motion_detection_sensitivity_value_icon.svg'; static const String motionDetectionSensitivityValueIcon =
'assets/icons/motion_detection_sensitivity_value_icon.svg';
static const String presenceTimeIcon = 'assets/icons/presence_time_icon.svg'; static const String presenceTimeIcon = 'assets/icons/presence_time_icon.svg';
static const String IlluminanceIcon = 'assets/icons/Illuminance_icon.svg'; static const String IlluminanceIcon = 'assets/icons/Illuminance_icon.svg';
static const String gear = 'assets/icons/gear.svg'; static const String gear = 'assets/icons/gear.svg';
@ -445,7 +425,8 @@ class Assets {
static const String motionMeter = 'assets/icons/motion_meter.svg'; static const String motionMeter = 'assets/icons/motion_meter.svg';
static const String spatialStaticValue = 'assets/icons/spatial_static_value.svg'; static const String spatialStaticValue = 'assets/icons/spatial_static_value.svg';
static const String spatialMotionValue = 'assets/icons/spatial_motion_value.svg'; static const String spatialMotionValue = 'assets/icons/spatial_motion_value.svg';
static const String presenceJudgementThrshold = 'assets/icons/presence_judgement_threshold.svg'; static const String presenceJudgementThrshold =
'assets/icons/presence_judgement_threshold.svg';
static const String spaceType = 'assets/icons/space_type.svg'; static const String spaceType = 'assets/icons/space_type.svg';
static const String sportsPara = 'assets/icons/sports_para.svg'; static const String sportsPara = 'assets/icons/sports_para.svg';
static const String sensitivityFeature1 = 'assets/icons/sensitivity_feature_1.svg'; static const String sensitivityFeature1 = 'assets/icons/sensitivity_feature_1.svg';
@ -457,4 +438,5 @@ class Assets {
static const String sensitivityFeature7 = 'assets/icons/sensitivity_feature_7.svg'; static const String sensitivityFeature7 = 'assets/icons/sensitivity_feature_7.svg';
static const String sensitivityFeature8 = 'assets/icons/sensitivity_feature_8.svg'; static const String sensitivityFeature8 = 'assets/icons/sensitivity_feature_8.svg';
static const String sensitivityFeature9 = 'assets/icons/sensitivity_feature_9.svg'; static const String sensitivityFeature9 = 'assets/icons/sensitivity_feature_9.svg';
static const String deviceTagIcon = 'assets/icons/device_tag_ic.svg';
} }