From 8d908e894b548ca96eca1702217815b10d3c6a07 Mon Sep 17 00:00:00 2001 From: ashrafzarkanisala Date: Tue, 26 Nov 2024 11:40:34 +0300 Subject: [PATCH] push routine name field --- lib/pages/routiens/bloc/routine_bloc/routine_bloc.dart | 6 ++++++ lib/pages/routiens/bloc/routine_bloc/routine_event.dart | 6 ++++++ lib/pages/routiens/widgets/routine_search_and_buttons.dart | 4 +++- 3 files changed, 15 insertions(+), 1 deletion(-) 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)); }, ), ),