This commit is contained in:
allllen4a 2024-09-19 15:13:14 +03:00
parent 84e1f6325f
commit 5cfe4a6ad9

View File

@ -35,7 +35,7 @@ class RecipeManager<T extends Recipe> {
List<T> _recipes = []; List<T> _recipes = [];
Future<void> addRecipe(T recipe) async { Future<void> addRecipe(T recipe) async {
await Future.delayed(Duration(seconds: 1)); // Имитация асинхронной операции await Future.delayed(Duration(seconds: 1));
_recipes.add(recipe); _recipes.add(recipe);
} }
@ -45,7 +45,7 @@ class RecipeManager<T extends Recipe> {
if (index < _recipes.length) { if (index < _recipes.length) {
return _recipes[index]; return _recipes[index];
} }
return null; // Вернём null, если индекс вне диапазона return null;
} }
} }
@ -78,7 +78,7 @@ class _RecipeHomeState extends State<RecipeHome> {
_nameController.clear(); _nameController.clear();
_ingredientsController.clear(); _ingredientsController.clear();
_selectedCuisine = null; _selectedCuisine = null;
setState(() {}); // Обновляем интерфейс setState(() {});
}); });
} }
} }
@ -137,4 +137,5 @@ class _RecipeHomeState extends State<RecipeHome> {
), ),
); );
} }
} }