mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-11-26 19:34:54 +00:00
solved dialog function re call bug
This commit is contained in:
@ -80,59 +80,23 @@ mixin SceneLogicHelper {
|
||||
|
||||
Widget getTheCorrectDialogBody(
|
||||
SceneStaticFunction taskItem,
|
||||
List<SceneStaticFunction>? listOfSceneStaticFunction,
|
||||
int? index,
|
||||
// List<SceneStaticFunction> functionOperation
|
||||
) {
|
||||
bool checkTaskItemAndOperation() {
|
||||
return taskItem.code == 'temp_set' || taskItem.code == 'countdown';
|
||||
}
|
||||
|
||||
bool checkListAndIndex() {
|
||||
if (listOfSceneStaticFunction == null || index == null) {
|
||||
return false;
|
||||
}
|
||||
return listOfSceneStaticFunction[index].code == 'temp_set' ||
|
||||
listOfSceneStaticFunction[index].code.contains('countdown') ||
|
||||
listOfSceneStaticFunction[index].code.contains('presence_time');
|
||||
}
|
||||
|
||||
if (checkTaskItemAndOperation()) {
|
||||
if (taskItem.code == 'temp_set') {
|
||||
return AlertDialogTemperatureBody(
|
||||
index: index!,
|
||||
functions: listOfSceneStaticFunction ?? [],
|
||||
functionValue: taskItem.functionValue,
|
||||
);
|
||||
} else if (taskItem.code == 'countdown') {
|
||||
return AlertDialogCountdown(
|
||||
durationValue: taskItem.functionValue,
|
||||
functionValue: taskItem.functionValue,
|
||||
function: taskItem,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
if (checkListAndIndex()) {
|
||||
if (listOfSceneStaticFunction![index!].code == 'temp_set') {
|
||||
return AlertDialogTemperatureBody(
|
||||
index: index,
|
||||
functions: listOfSceneStaticFunction,
|
||||
functionValue: taskItem.functionValue,
|
||||
);
|
||||
} else {
|
||||
return AlertDialogCountdown(
|
||||
durationValue: listOfSceneStaticFunction[index].functionValue ??
|
||||
taskItem.functionValue,
|
||||
functionValue: taskItem.functionValue,
|
||||
function: listOfSceneStaticFunction[index],
|
||||
);
|
||||
}
|
||||
if (taskItem.code.contains('temp_set')) {
|
||||
return AlertDialogTemperatureBody(
|
||||
taskItem: taskItem,
|
||||
functionValue: taskItem.functionValue,
|
||||
);
|
||||
} else if (taskItem.code.contains('countdown') ||
|
||||
taskItem.deviceId.contains('delay')) {
|
||||
return AlertDialogCountdown(
|
||||
durationValue: taskItem.functionValue,
|
||||
functionValue: taskItem.functionValue,
|
||||
function: taskItem,
|
||||
);
|
||||
}
|
||||
|
||||
return AlertDialogFunctionsOperationsBody(
|
||||
index: index ?? 0,
|
||||
functions: listOfSceneStaticFunction ?? [],
|
||||
taskItem: taskItem,
|
||||
functionValue: taskItem.functionValue,
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user