Simple recipe provider changes

This commit is contained in:
SomnusVeritas
2023-10-17 18:23:05 +02:00
parent 11266b9ab4
commit 31a5933919
2 changed files with 30 additions and 11 deletions

View File

@@ -5,7 +5,7 @@ import 'steps.dart';
class Recipe {
final String title;
final String description;
final DifficultyUtil? difficulty;
final Difficulty? difficulty;
final List<Ingredient> ingredients = [];
final Steps steps = Steps();

View File

@@ -1,19 +1,38 @@
import 'package:flutter/material.dart';
import 'package:rezepte/models/difficulty.dart';
import 'package:rezepte/models/ingredient.dart';
import 'package:rezepte/models/steps.dart';
import '../../models/recipe.dart';
class RecipeProvider extends ChangeNotifier {
Recipe? _selectedRecipe;
Recipe? get selectedRecipe => _selectedRecipe;
set selectedRecipe(Recipe? recipe) {
_selectedRecipe = recipe;
notifyListeners();
}
class RecipeProvider extends ChangeNotifier implements Recipe {
String _title = '';
String _description = '';
Difficulty? _difficulty;
List<Ingredient> _ingredients = [];
Steps _steps = Steps();
void clearRecipe() {
_selectedRecipe = null;
_title = '';
_description = '';
_difficulty = null;
_ingredients = [];
_steps = Steps();
notifyListeners();
}
@override
String get description => _description;
@override
String get title => _title;
@override
Difficulty? get difficulty => _difficulty;
@override
List<Ingredient> get ingredients => _ingredients;
@override
Steps get steps => _steps;
}