diff --git a/lib/models/recipe.dart b/lib/models/recipe.dart index 91fa36e..bc6d968 100644 --- a/lib/models/recipe.dart +++ b/lib/models/recipe.dart @@ -2,20 +2,6 @@ import '../src/enums.dart' show Difficulty, Cuisine, MealCategory; import 'ingredient_list_entry.dart'; class Recipe { - final int id; - final String title; - final String description; - final Difficulty difficulty; - final List ingredients; - final List steps; - final DateTime datePublished; - final Duration prepTime; - final Duration cookTime; - final Duration totalTime; - final List keywords; - final MealCategory? mealCategory; - final Cuisine? cuisine; - Recipe({ this.id = -1, this.title = '', @@ -24,7 +10,6 @@ class Recipe { required this.datePublished, this.prepTime = const Duration(), this.cookTime = const Duration(), - this.totalTime = const Duration(), this.mealCategory, this.cuisine, this.ingredients = const [], @@ -32,6 +17,21 @@ class Recipe { this.steps = const [], }); + final Duration cookTime; + final Cuisine? cuisine; + final DateTime datePublished; + final String description; + final Difficulty difficulty; + final int id; + final List ingredients; + final List keywords; + final MealCategory? mealCategory; + final Duration prepTime; + final List steps; + final String title; + + Duration get totalTime => cookTime + prepTime; + Recipe copyWith({ int? id, String? title, @@ -61,7 +61,6 @@ class Recipe { datePublished: datePublished ?? this.datePublished, prepTime: prepTime ?? this.prepTime, cookTime: cookTime ?? this.cookTime, - totalTime: totalTime ?? this.totalTime, keywords: keywords != null ? List.from(keywords) : List.from(this.keywords), diff --git a/lib/services/providers/recipe_provider.dart b/lib/services/providers/recipe_provider.dart index 29527ff..03fc6b7 100644 --- a/lib/services/providers/recipe_provider.dart +++ b/lib/services/providers/recipe_provider.dart @@ -66,13 +66,6 @@ class RecipeProvider extends ChangeNotifier { } } - void updateTotalTime(Duration totalTime, {bool silent = false}) { - _recipe = _recipe.copyWith(totalTime: totalTime); - if (!silent) { - notifyListeners(); - } - } - void updateKeywords(List keywords, {bool silent = false}) { _recipe = _recipe.copyWith(keywords: keywords); if (!silent) {