반응형
https://github.com/CantC0unt/RecipeCalculator/blob/master/lib/recipe.dart
GitHub - CantC0unt/RecipeCalculator: A simple app made in flutter.
A simple app made in flutter. Contribute to CantC0unt/RecipeCalculator development by creating an account on GitHub.
github.com
위 계산기를 클론코딩을 하였다.
그제 한 계산기와 거의 같다.
한번 입력된 레시피 양에
슬라이더 값이 변함에 따라 추가적으로 넣어야 하는 레시피가 달라지게 하는 계산기이다.
index 관련 오류가 생겼지만 이는 모델에 입력된 순서와 UI에서 나오는 모델의 값 순서가 달라서 생기는 문제 인 듯 하다.
모델클래스
class Recipe {
String name;
int servings;
List<Ingredient> ingredients=[];
Recipe(this.name,this.servings,this.ingredients);
static List<Recipe>data=[
Recipe("Chocolate Chip Cookies", 36, [
Ingredient(1, "cup", "Salted Butter", "softened"),
Ingredient(1, "cup", "white sugar", "granulated"),
Ingredient(1, "cup", "light brown sugar", "packed"),
Ingredient(2, "tsp", "pure vanilla extract", ""),
Ingredient(2, "", "large eggs", ""),
Ingredient(3, "cups", "all-purpose flour", ""),
Ingredient(1, "tsp", "baking soda", ""),
Ingredient(0.5, "tsp", "baking powder", ""),
Ingredient(1, "tsp", "sea salt", ""),
Ingredient(
2, "cups", "chocolate chips", "or chunks, or chopped chocolate")
]),
];
}
class Ingredient{
double amount;
String unit;
String item;
String additional;
Ingredient(this.amount,this.unit,this.item,this.additional);
}
반응형
'Flutter-플러터 > 클론코딩' 카테고리의 다른 글
Getx 연락처 코드 클론코딩 (0) | 2023.03.07 |
---|---|
Get x Todo 클론코딩 (0) | 2023.03.03 |
레시피 계산기 클론코딩 (0) | 2023.02.24 |
Expense Tracker (0) | 2023.02.18 |
todo 클론코딩 (0) | 2023.02.13 |