created different models
This commit is contained in:
16
lib/models/ingredient.dart
Normal file
16
lib/models/ingredient.dart
Normal file
@@ -0,0 +1,16 @@
|
||||
import '../src/enums.dart' show IngredientType;
|
||||
import 'unit.dart';
|
||||
|
||||
class Ingredient {
|
||||
final String title;
|
||||
final List<Unit> possibleUnits;
|
||||
final List<String> preferredBrands;
|
||||
final IngredientType type;
|
||||
|
||||
Ingredient({
|
||||
required this.title,
|
||||
required this.type,
|
||||
this.possibleUnits = const [],
|
||||
this.preferredBrands = const [],
|
||||
});
|
||||
}
|
||||
11
lib/models/ingredient_list_entry.dart
Normal file
11
lib/models/ingredient_list_entry.dart
Normal file
@@ -0,0 +1,11 @@
|
||||
import 'ingredient.dart';
|
||||
import 'unit.dart';
|
||||
|
||||
class IngredientListEntry {
|
||||
final Ingredient ingredient;
|
||||
final int amount;
|
||||
final Unit unit;
|
||||
final bool optional;
|
||||
|
||||
IngredientListEntry(this.ingredient, this.amount, this.unit, this.optional);
|
||||
}
|
||||
31
lib/models/recipe.dart
Normal file
31
lib/models/recipe.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
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<IngredientListEntry> ingredients = [];
|
||||
final List<String> steps = [];
|
||||
final DateTime datePublished;
|
||||
final Duration prepTime;
|
||||
final Duration cookTime;
|
||||
final Duration totalTime;
|
||||
final List<String> keywords = [];
|
||||
final MealCategory mealCategory;
|
||||
final Cuisine cuisine;
|
||||
|
||||
Recipe({
|
||||
required this.id,
|
||||
required this.title,
|
||||
required this.description,
|
||||
required this.difficulty,
|
||||
required this.datePublished,
|
||||
required this.prepTime,
|
||||
required this.cookTime,
|
||||
required this.totalTime,
|
||||
required this.mealCategory,
|
||||
required this.cuisine,
|
||||
});
|
||||
}
|
||||
9
lib/models/unit.dart
Normal file
9
lib/models/unit.dart
Normal file
@@ -0,0 +1,9 @@
|
||||
import '../src/enums.dart' show UnitType, System;
|
||||
|
||||
class Unit {
|
||||
final String name;
|
||||
final UnitType type;
|
||||
final System system;
|
||||
|
||||
Unit(this.name, this.type, {this.system = System.metric});
|
||||
}
|
||||
Reference in New Issue
Block a user