mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-26 04:07:56 +00:00
fixed automation bugs
This commit is contained in:
@@ -191,19 +191,28 @@ class CreateSceneBloc extends Bloc<CreateSceneEvent, CreateSceneState>
|
||||
|
||||
FutureOr<void> _selectedValue(
|
||||
SelectedValueEvent event, Emitter<CreateSceneState> emit) {
|
||||
emit(CreateSceneLoading());
|
||||
if (event.isAutomation == true) {
|
||||
automationSelectedValues[event.code] = event.value;
|
||||
automationComparatorValues[event.code] = event.comparator ?? '==';
|
||||
emit(SelectedTaskValueState(value: event.value));
|
||||
emit(AddSceneTask(
|
||||
tasksList: tasksList, automationTasksList: automationTasksList));
|
||||
|
||||
// Update the comparator value for the specific task in automationTasksList
|
||||
for (int i = 0; i < automationTasksList.length; i++) {
|
||||
if (automationTasksList[i].code == event.code) {
|
||||
automationTasksList[i] = automationTasksList[i].copyWith(
|
||||
comparator: event.comparator ?? '==',
|
||||
functionValue: event.value,
|
||||
);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
selectedValues[event.code] = event.value;
|
||||
emit(SelectedTaskValueState(value: event.value));
|
||||
emit(AddSceneTask(
|
||||
tasksList: tasksList, automationTasksList: automationTasksList));
|
||||
}
|
||||
emit(SelectedTaskValueState(value: event.value));
|
||||
emit(AddSceneTask(
|
||||
tasksList: List.from(tasksList),
|
||||
automationTasksList: List.from(automationTasksList),
|
||||
));
|
||||
}
|
||||
|
||||
FutureOr<void> _removeTaskById(
|
||||
|
||||
Reference in New Issue
Block a user