forked from eatvio/eatvio_app
refactor(iOS): Refactoring for iOS bundle
This commit is contained in:
@@ -38,6 +38,7 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
on<SendModeration>(_sendModeration);
|
||||
on<RefreshEvent>(
|
||||
reloadScreen); //пользователь нажимает "Добавить комментарий"
|
||||
on<ClearInput>(_clearInput);
|
||||
}
|
||||
|
||||
Future<void> _onInitialize(
|
||||
@@ -547,6 +548,17 @@ class DiaryEditBloc extends Bloc<DiaryEditEvent, DiaryEditState> {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
FutureOr<void> _clearInput(
|
||||
ClearInput event, Emitter<DiaryEditState> emit) {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
var currentState = state as DiaryEditLoadedState;
|
||||
DiaryEditLoadedState updatedState = currentState.copyWith(
|
||||
);
|
||||
emit(updatedState);
|
||||
}
|
||||
}
|
||||
|
||||
FutureOr<void> _changePortion(
|
||||
ChangePortion event, Emitter<DiaryEditState> emit) {
|
||||
if (state is DiaryEditLoadedState) {
|
||||
|
||||
@@ -122,6 +122,15 @@ class ChangeMeal extends DiaryEditEvent {
|
||||
List<Object?> get props => [value, meals];
|
||||
}
|
||||
|
||||
|
||||
class ClearInput extends DiaryEditEvent {
|
||||
ClearInput({required this.value});
|
||||
|
||||
TextEditingController value;
|
||||
@override
|
||||
List<Object?> get props => [value];
|
||||
}
|
||||
|
||||
class ChangePortion extends DiaryEditEvent {
|
||||
ChangePortion({required this.value});
|
||||
|
||||
|
||||
@@ -376,7 +376,6 @@ class DiaryEditScreen extends StatelessWidget {
|
||||
) {
|
||||
if (state.isAdded) {
|
||||
print("Clear");
|
||||
productEditingController.clear();
|
||||
}
|
||||
return CustomTextFormField(
|
||||
hintText: "Введите название продукта",
|
||||
|
||||
Reference in New Issue
Block a user