refactor: update function handling in routine dialogs

This commit is contained in:
mohammad
2025-06-18 14:40:25 +03:00
parent b9a3b9c719
commit 63da660ece
13 changed files with 158 additions and 53 deletions

View File

@ -117,10 +117,22 @@ class ACHelper {
},
onConfirm: state.addedFunctions.isNotEmpty
? () {
final selectedFunctionData =
state.addedFunctions.firstWhere(
(f) =>
f.functionCode == state.selectedFunction,
orElse: () => DeviceFunctionData(
entityId: '',
functionCode: state.selectedFunction ?? '',
operationName: '',
value: null,
),
);
/// add the functions to the routine bloc
context.read<RoutineBloc>().add(
AddFunctionToRoutine(
state.addedFunctions,
[selectedFunctionData],
uniqueCustomId,
),
);