Simple recipe provider changes
This commit is contained in:
@@ -5,7 +5,7 @@ import 'steps.dart';
|
|||||||
class Recipe {
|
class Recipe {
|
||||||
final String title;
|
final String title;
|
||||||
final String description;
|
final String description;
|
||||||
final DifficultyUtil? difficulty;
|
final Difficulty? difficulty;
|
||||||
final List<Ingredient> ingredients = [];
|
final List<Ingredient> ingredients = [];
|
||||||
final Steps steps = Steps();
|
final Steps steps = Steps();
|
||||||
|
|
||||||
|
|||||||
@@ -1,19 +1,38 @@
|
|||||||
import 'package:flutter/material.dart';
|
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';
|
import '../../models/recipe.dart';
|
||||||
|
|
||||||
class RecipeProvider extends ChangeNotifier {
|
class RecipeProvider extends ChangeNotifier implements Recipe {
|
||||||
Recipe? _selectedRecipe;
|
String _title = '';
|
||||||
|
String _description = '';
|
||||||
Recipe? get selectedRecipe => _selectedRecipe;
|
Difficulty? _difficulty;
|
||||||
|
List<Ingredient> _ingredients = [];
|
||||||
set selectedRecipe(Recipe? recipe) {
|
Steps _steps = Steps();
|
||||||
_selectedRecipe = recipe;
|
|
||||||
notifyListeners();
|
|
||||||
}
|
|
||||||
|
|
||||||
void clearRecipe() {
|
void clearRecipe() {
|
||||||
_selectedRecipe = null;
|
_title = '';
|
||||||
|
_description = '';
|
||||||
|
_difficulty = null;
|
||||||
|
_ingredients = [];
|
||||||
|
_steps = Steps();
|
||||||
notifyListeners();
|
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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user