Simple recipe provider changes
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user