started work on first parsing of a yaml pizza recipe
This commit is contained in:
parent
1339bbdff2
commit
44b32a6416
5 changed files with 126 additions and 2 deletions
65
assets/recipes/neapolitan.yaml
Normal file
65
assets/recipes/neapolitan.yaml
Normal file
|
@ -0,0 +1,65 @@
|
|||
recipe:
|
||||
name: "Neapolitan Cold Rise"
|
||||
description: >
|
||||
A Neapolitan Style pizza with a multi day cold rise
|
||||
ingredients:
|
||||
method: ratio
|
||||
items:
|
||||
- name: flour
|
||||
unit: g
|
||||
value: 0.595
|
||||
- name: water
|
||||
unit: ml
|
||||
value: 0.386
|
||||
- name: salt
|
||||
unit: g
|
||||
value: 0.0178
|
||||
- name: yeast
|
||||
unit: g
|
||||
value: 0.0012
|
||||
steps:
|
||||
- name: Make the dough
|
||||
wait:
|
||||
unit: days
|
||||
min: 1
|
||||
max: 5
|
||||
description: >
|
||||
Combine all the ingredients to make the dough, we start with just the water and salt and add the yeast after adding some of the flour to not kill the yeast.
|
||||
substeps:
|
||||
- name: Salt+Water
|
||||
description: >
|
||||
Combine the salt and the water in a bowl, stir until the salt dissolves.
|
||||
- name: +20% flour
|
||||
description: >
|
||||
Add ~20% of the flour to the water/salt mixture and mix everything together.
|
||||
- name: Yeast
|
||||
description: >
|
||||
Add the yeast to the mixture.
|
||||
- name: Flour
|
||||
description: >
|
||||
Add the rest of the flour to the mixture, knead the dough for 15-20 minutes.
|
||||
- name: Fridge
|
||||
description: >
|
||||
Place the dough in a sealed/covered container in the fridge.
|
||||
- name: Warm rise
|
||||
wait:
|
||||
unit: hours
|
||||
min: 3
|
||||
max: 6
|
||||
description: >
|
||||
Take the dough out of the fridge and let it come to room temperature for a final rise before baking
|
||||
substeps:
|
||||
- name: Split
|
||||
description: >
|
||||
Split the dough into smaller balls and place them into a covered/sealed container(s)
|
||||
- name: Preheat Oven
|
||||
wait:
|
||||
unit: minutes
|
||||
min: 30
|
||||
max: 120
|
||||
description: >
|
||||
Preheat the oven in advance to ensure it's as hot as it can be
|
||||
A high (250 to 300 degrees celsius) is recommended)
|
||||
- name: Pizza Time!
|
||||
description: >
|
||||
Time to make pizza!
|
7
lib/entities/PizzaRecipe/Ingredient.dart
Normal file
7
lib/entities/PizzaRecipe/Ingredient.dart
Normal file
|
@ -0,0 +1,7 @@
|
|||
class Ingredient {
|
||||
final String name;
|
||||
final String unit;
|
||||
final double value;
|
||||
|
||||
Ingredient(this.name, this.unit, this.value);
|
||||
}
|
8
lib/entities/PizzaRecipe/Ingredients.dart
Normal file
8
lib/entities/PizzaRecipe/Ingredients.dart
Normal file
|
@ -0,0 +1,8 @@
|
|||
import 'package:pizzaplanner/entities/PizzaRecipe/Ingredient.dart';
|
||||
|
||||
class Ingredients {
|
||||
final Map<String, Ingredient> ingredients;
|
||||
final String method;
|
||||
|
||||
Ingredients(this.ingredients, this.method);
|
||||
}
|
43
lib/entities/PizzaRecipe/PizzaRecipe.dart
Normal file
43
lib/entities/PizzaRecipe/PizzaRecipe.dart
Normal file
|
@ -0,0 +1,43 @@
|
|||
import 'package:flutter/services.dart' show rootBundle;
|
||||
import 'package:pizzaplanner/entities/PizzaRecipe/Ingredient.dart';
|
||||
|
||||
import 'package:pizzaplanner/entities/PizzaRecipe/Ingredients.dart';
|
||||
import 'package:yaml/yaml.dart';
|
||||
|
||||
class PizzaRecipe {
|
||||
final String name;
|
||||
final String description;
|
||||
final Ingredients ingredients;
|
||||
|
||||
PizzaRecipe(this.name, this.description, this.ingredients);
|
||||
|
||||
static Future<PizzaRecipe> fromYaml() async{
|
||||
String yamlString = await loadAsset("assets/recipes/neapolitan.yaml");
|
||||
var yaml = loadYaml(yamlString);
|
||||
var recipe = yaml["recipe"];
|
||||
|
||||
String name = recipe["name"];
|
||||
String description = recipe["description"];
|
||||
|
||||
YamlMap ingredientsBlock = recipe["ingredients"];
|
||||
String ingredientMethod = ingredientsBlock["method"];
|
||||
YamlList ingredients = ingredientsBlock["items"];
|
||||
|
||||
var newIngredients = Map<String, Ingredient>.fromIterable(ingredients,
|
||||
key: (ingredient) => ingredient["name"],
|
||||
value: (ingredient) => Ingredient(ingredient["name"], ingredient["unit"], ingredient["value"])
|
||||
);
|
||||
|
||||
print(newIngredients);
|
||||
|
||||
return PizzaRecipe(
|
||||
name,
|
||||
description,
|
||||
Ingredients(newIngredients, ingredientMethod)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Future<String> loadAsset(String path) async {
|
||||
return await rootBundle.loadString(path);
|
||||
}
|
|
@ -30,6 +30,7 @@ dependencies:
|
|||
cupertino_icons: ^1.0.3
|
||||
fluttericon: ^2.0.0
|
||||
flutter_datetime_picker: ^1.5.1
|
||||
yaml: ^3.1.0
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
|
@ -47,8 +48,8 @@ flutter:
|
|||
uses-material-design: true
|
||||
|
||||
# To add assets to your application, add an assets section, like this:
|
||||
# assets:
|
||||
# - images/a_dot_burr.jpeg
|
||||
assets:
|
||||
- assets/recipes/
|
||||
# - images/a_dot_ham.jpeg
|
||||
|
||||
# An image asset can refer to one or more resolution-specific "variants", see
|
||||
|
|
Loading…
Add table
Reference in a new issue