bug fixes

This commit is contained in:
Abdullah Alassaf
2024-11-28 01:12:18 +03:00
parent 9b5ddc4dc8
commit 3b18c4e8cf
4 changed files with 44 additions and 14 deletions

View File

@ -363,11 +363,20 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
ifItems.removeAt(event.index);
selectedFunctions.remove(event.key);
emit(state.copyWith(ifItems: ifItems, selectedFunctions: selectedFunctions));
if (ifItems.isEmpty && state.thenItems.isEmpty) {
emit(state.copyWith(
ifItems: ifItems,
selectedFunctions: selectedFunctions,
isAutomation: false,
isTabToRun: false));
} else {
emit(state.copyWith(ifItems: ifItems, selectedFunctions: selectedFunctions));
}
}
}
FutureOr<void> _changeOperatorOperator(ChangeAutomationOperator event, Emitter<RoutineState> emit) {
FutureOr<void> _changeOperatorOperator(
ChangeAutomationOperator event, Emitter<RoutineState> emit) {
emit(state.copyWith(
selectedAutomationOperator: event.operator,
));
@ -396,7 +405,7 @@ class RoutineBloc extends Bloc<RoutineEvent, RoutineState> {
selectedIcon: null,
isTabToRun: false,
isAutomation: false,
selectedAutomationOperator: 'AND',
selectedAutomationOperator: 'or',
effectiveTime: null,
routineName: null,
);