diff --git a/lib/pages/create_recipe_page.dart b/lib/pages/create_recipe_page.dart index 8879584..1637743 100644 --- a/lib/pages/create_recipe_page.dart +++ b/lib/pages/create_recipe_page.dart @@ -47,6 +47,7 @@ class _CreateRecipeState extends State { color: Theme.of(context).colorScheme.onBackground), ), TextFormField( + maxLines: 4, onChanged: (value) => recipe.description = value, decoration: const InputDecoration( label: Text('Description'), @@ -93,7 +94,21 @@ class _CreateRecipeState extends State { recipe.ingredients.add(ingredient); }); - void _onIngredientRemoveTapped(int index) {} + void _onIngredientRemoveTapped(int index) { + final removedIngredient = recipe.ingredients.elementAt(index); + + recipe.removeIngredientAt(index); + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: const Text('Ingredient Removed'), + action: SnackBarAction( + label: 'Undo', + onPressed: () { + recipe.addIngredient(removedIngredient); + }), + ), + ); + } Widget? _ingredientListBuilder(BuildContext context, int index) { final ingredient = recipe.ingredients.elementAt(index);