feat:更新菜谱表单

This commit is contained in:
2026-06-28 23:17:00 +08:00
parent c10e8e5ffb
commit 613e50b0da
5 changed files with 275 additions and 330 deletions

View File

@@ -13,6 +13,7 @@ import 'package:food_hub_app/views/record.dart';
class FoodProvider with ChangeNotifier {
late RecordTab currentRecordTab = RecordTab.recipe;
late FoodRecord recordFormItem;
late Recipe recipeFormItem;
late Moment momentFormItem;
late bool isEditing;
@@ -55,6 +56,16 @@ class FoodProvider with ChangeNotifier {
notifyListeners();
}
void resetRecipeForm() {
recipeFormItem = Recipe.getEmpty();
notifyListeners();
}
void initRecipeForm(Recipe recipe) {
recipeFormItem = recipe;
notifyListeners();
}
void updateRecordFormItem({String? name, String? date, String? imageUrl}) {
if (name != null) recordFormItem.name = name;
if (date != null) recordFormItem.date = date;