feat(recipe): Recipe create layouts

This commit is contained in:
2024-05-28 14:23:49 +03:00
parent b80eb6b33a
commit 1d1e25b1dd
3 changed files with 338 additions and 50 deletions

View File

@@ -35,12 +35,18 @@ class RecipeCreateBloc extends Bloc<RecipeCreateEvent, RecipeCreateState> {
recipeModelObj: currentState.recipeModelObj,
title: currentState.title,
description: currentState.description,
video_url: currentState.video_url));
video_url: currentState.video_url,
steps: currentState.steps));
} else {
final Map<String, dynamic> step = {
'description': '',
'image': '',
};
emit(RecipeCreateLoadedState(
title: TextEditingController(),
description: TextEditingController(),
video_url: TextEditingController()));
video_url: TextEditingController(),
steps: [step]));
}
}

View File

@@ -23,25 +23,33 @@ class RecipeCreateState extends Equatable {
class RecipeCreateLoadedState extends RecipeCreateState {
RecipeCreateLoadedState(
{this.recipeModelObj, this.title, this.description, this.video_url});
{this.recipeModelObj,
this.title,
this.description,
this.video_url,
this.steps});
RecipeCreateModel? recipeModelObj;
TextEditingController? title;
TextEditingController? description;
TextEditingController? video_url;
List<dynamic>? steps;
@override
List<Object?> get props => [recipeModelObj, title, description, video_url];
List<Object?> get props =>
[recipeModelObj, title, description, video_url, steps];
RecipeCreateLoadedState copyWith({
RecipeCreateModel? recipeModelObj,
TextEditingController? title,
TextEditingController? description,
TextEditingController? video_url,
List<dynamic>? steps,
}) {
return RecipeCreateLoadedState(
recipeModelObj: recipeModelObj ?? this.recipeModelObj,
title: title ?? this.title,
description: description ?? this.description,
video_url: video_url ?? this.video_url,
steps: steps ?? this.steps,
);
}
}