refactored cooking steps
This commit is contained in:
6
lib/models/cooking_step.dart
Normal file
6
lib/models/cooking_step.dart
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
class CookingStep {
|
||||||
|
final String title;
|
||||||
|
final String description;
|
||||||
|
|
||||||
|
CookingStep({required this.title, this.description = ''});
|
||||||
|
}
|
||||||
@@ -10,4 +10,10 @@ class Ingredient {
|
|||||||
required this.possibleUnits,
|
required this.possibleUnits,
|
||||||
this.preferredBrands = const [],
|
this.preferredBrands = const [],
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool operator ==(other) {
|
||||||
|
Ingredient i = other as Ingredient;
|
||||||
|
return title == i.title;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,13 +1,13 @@
|
|||||||
import 'difficulty.dart';
|
import 'difficulty.dart';
|
||||||
import 'ingredient.dart';
|
import 'ingredient.dart';
|
||||||
import 'steps.dart';
|
import 'cooking_step.dart';
|
||||||
|
|
||||||
class Recipe {
|
class Recipe {
|
||||||
final String title;
|
final String title;
|
||||||
final String description;
|
final String description;
|
||||||
final Difficulty? difficulty;
|
final Difficulty? difficulty;
|
||||||
final List<Ingredient> ingredients = [];
|
final List<Ingredient> ingredients = [];
|
||||||
final Steps steps = Steps();
|
final List<CookingStep> steps = [];
|
||||||
|
|
||||||
Recipe({
|
Recipe({
|
||||||
required this.title,
|
required this.title,
|
||||||
|
|||||||
@@ -1,13 +0,0 @@
|
|||||||
/// Used to display the steps required to cook the referenced recipe
|
|
||||||
class Steps {
|
|
||||||
final List<CookingStep> steps = [];
|
|
||||||
|
|
||||||
void add(CookingStep step) => steps.add(step);
|
|
||||||
}
|
|
||||||
|
|
||||||
class CookingStep {
|
|
||||||
final String title;
|
|
||||||
final String description;
|
|
||||||
|
|
||||||
CookingStep({required this.title, this.description = ''});
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user