diff --git a/lib/pages/routiens/bloc/routine_bloc/routine_bloc.dart b/lib/pages/routiens/bloc/routine_bloc/routine_bloc.dart index 64872925..7694e8ec 100644 --- a/lib/pages/routiens/bloc/routine_bloc/routine_bloc.dart +++ b/lib/pages/routiens/bloc/routine_bloc/routine_bloc.dart @@ -31,6 +31,7 @@ class RoutineBloc extends Bloc { on(_changeOperatorOperator); on(_onEffectiveTimeEvent); on(_onCreateAutomation); + on(_onSetRoutineName); // on(_onRemoveFunction); // on(_onClearFunctions); } @@ -350,4 +351,9 @@ class RoutineBloc extends Bloc { EffectiveTimePeriodEvent event, Emitter emit) { emit(state.copyWith(effectiveTime: event.effectiveTime)); } + + FutureOr _onSetRoutineName( + SetRoutineName event, Emitter emit) { + emit(state.copyWith(routineName: event.name)); + } } diff --git a/lib/pages/routiens/bloc/routine_bloc/routine_event.dart b/lib/pages/routiens/bloc/routine_bloc/routine_event.dart index 2a89d1b4..9337e88e 100644 --- a/lib/pages/routiens/bloc/routine_bloc/routine_event.dart +++ b/lib/pages/routiens/bloc/routine_bloc/routine_event.dart @@ -115,4 +115,10 @@ class CreateAutomationEvent extends RoutineEvent { List get props => []; } +class SetRoutineName extends RoutineEvent { + final String name; + const SetRoutineName(this.name); + @override + List get props => [name]; +} class ClearFunctions extends RoutineEvent {} diff --git a/lib/pages/routiens/widgets/routine_search_and_buttons.dart b/lib/pages/routiens/widgets/routine_search_and_buttons.dart index 01352bf8..5bf9db8e 100644 --- a/lib/pages/routiens/widgets/routine_search_and_buttons.dart +++ b/lib/pages/routiens/widgets/routine_search_and_buttons.dart @@ -45,7 +45,9 @@ class RoutineSearchAndButtons extends StatelessWidget { isRequired: true, width: 450, onChanged: (value) { - // context.read().add(SearchRoutines(value)); + context + .read() + .add(SetRoutineName(value)); }, ), ),