feat:更新菜谱表单

This commit is contained in:
2026-06-23 20:02:17 +08:00
parent ed0ceb29d3
commit a5e788eee6
7 changed files with 846 additions and 35 deletions

View File

@@ -5,11 +5,13 @@ part 'recipe.g.dart';
/// 食材信息
@JsonSerializable()
class RecipeMaterial {
int id;
String type;
String name;
String amount;
RecipeMaterial({
required this.id,
required this.type,
required this.name,
required this.amount,
@@ -24,11 +26,13 @@ class RecipeMaterial {
/// 步骤信息
@JsonSerializable()
class RecipeStep {
int id;
int sort;
String content;
String imageUrl;
RecipeStep({
required this.id,
required this.sort,
required this.content,
required this.imageUrl,

View File

@@ -8,6 +8,7 @@ part of 'recipe.dart';
RecipeMaterial _$RecipeMaterialFromJson(Map<String, dynamic> json) =>
RecipeMaterial(
id: (json['id'] as num).toInt(),
type: json['type'] as String,
name: json['name'] as String,
amount: json['amount'] as String,
@@ -15,12 +16,14 @@ RecipeMaterial _$RecipeMaterialFromJson(Map<String, dynamic> json) =>
Map<String, dynamic> _$RecipeMaterialToJson(RecipeMaterial instance) =>
<String, dynamic>{
'id': instance.id,
'type': instance.type,
'name': instance.name,
'amount': instance.amount,
};
RecipeStep _$RecipeStepFromJson(Map<String, dynamic> json) => RecipeStep(
id: (json['id'] as num).toInt(),
sort: (json['sort'] as num).toInt(),
content: json['content'] as String,
imageUrl: json['imageUrl'] as String,
@@ -28,6 +31,7 @@ RecipeStep _$RecipeStepFromJson(Map<String, dynamic> json) => RecipeStep(
Map<String, dynamic> _$RecipeStepToJson(RecipeStep instance) =>
<String, dynamic>{
'id': instance.id,
'sort': instance.sort,
'content': instance.content,
'imageUrl': instance.imageUrl,