Fixed design issues

This commit is contained in:
Abdullah Alassaf
2024-08-04 19:36:19 +03:00
parent 305680a082
commit a5a2446942
3 changed files with 26 additions and 35 deletions

View File

@ -15,10 +15,13 @@ import 'package:syncrow_app/utils/context_extension.dart';
mixin SceneLogicHelper {
bool isOnlyDelayOrDelayLast(List<SceneStaticFunction> tasks) {
final lastTask = tasks.last;
return tasks.every((task) => task.code == 'delay') ||
lastTask.code == 'delay' ||
lastTask.deviceId == 'delay';
final lastTask = tasks.isNotEmpty ? tasks.last : null;
return tasks.isNotEmpty
? tasks.every((task) => task.code == 'delay') ||
lastTask!.code == 'delay' ||
lastTask.deviceId == 'delay'
: false;
}
void handleSaveButtonPress(
@ -177,24 +180,21 @@ mixin SceneLogicHelper {
}
}
Widget getTheCorrectDialogBody(
SceneStaticFunction taskItem, dynamic functionValue,
Widget getTheCorrectDialogBody(SceneStaticFunction taskItem, dynamic functionValue,
{required bool isAutomation}) {
if (taskItem.operationDialogType == OperationDialogType.temperature) {
return AlertDialogTemperatureBody(
taskItem: taskItem,
functionValue: functionValue ?? taskItem.functionValue,
);
} else if ((taskItem.operationDialogType ==
OperationDialogType.countdown) ||
} else if ((taskItem.operationDialogType == OperationDialogType.countdown) ||
(taskItem.operationDialogType == OperationDialogType.delay)) {
return AlertDialogCountdown(
durationValue: taskItem.functionValue ?? 0,
functionValue: functionValue ?? taskItem.functionValue,
function: taskItem,
);
} else if (taskItem.operationDialogType ==
OperationDialogType.integerSteps) {
} else if (taskItem.operationDialogType == OperationDialogType.integerSteps) {
return AlertDialogSliderSteps(
taskItem: taskItem,
functionValue: functionValue ?? taskItem.functionValue,