Created
August 28, 2021 04:00
-
-
Save doyle-flutter/d451a4832f61fd91f69ce62f3c2c8ecf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:flutter/material.dart'; | |
| void main() => runApp(Sys()); | |
| class FoodIngredient{ | |
| String productName; | |
| String gramme; | |
| FoodIngredient({required this.productName,required this.gramme}); | |
| } | |
| abstract class Food{ | |
| void serve(); | |
| Future<void> cooking(); | |
| } | |
| abstract class Jjigae implements Food{ | |
| final String name; | |
| final FoodIngredient water; | |
| final List<FoodIngredient> spices; | |
| final List<FoodIngredient> vegetables; | |
| final List<FoodIngredient> meats; | |
| Jjigae(this.name, this.water, this.spices, this.vegetables, this.meats); | |
| Future<void> cutting(); | |
| Future<void> boiling(); | |
| Future<void> cooking() async{ | |
| print("π"); | |
| print("${this.name}μ(λ₯Ό) μ리λ₯Ό μμν©λλ€ !"); | |
| return await Future<void>.delayed(Duration(seconds: 1), (){}); | |
| } | |
| Future<void> serve() async{ | |
| await this.cooking(); | |
| await this.showFoodIngredient(); | |
| await this.cutting(); | |
| await this.boiling(); | |
| print("κ·Έλ¦μ μ―겨 λ΄μ μ€λλ€."); | |
| await Future.delayed(Duration(seconds: 1), () => print("ππ²")); | |
| print("'${this.name}' μ΄(κ°) μμ±λμμ΅λλ€!"); | |
| print("π€©"); | |
| print("\n"); | |
| return; | |
| } | |
| Future<void> cboiling({required List<FoodIngredient> fis, required int min, bool isAdd = false}) async{ | |
| FoodIngredient boilingIngredients = FoodIngredient(productName: "", gramme: ""); | |
| for(FoodIngredient v in fis){ | |
| boilingIngredients.productName += "${v.productName}_${v.gramme}" + (fis.indexOf(v) == fis.length-1 ? "" : ","); | |
| if(boilingIngredients.gramme.isEmpty){ | |
| boilingIngredients.gramme += v.gramme; | |
| } | |
| else{ | |
| boilingIngredients.gramme = (int.parse(boilingIngredients.gramme.split('g')[0]) + int.parse(v.gramme.split("g")[0])).toString() + "g"; | |
| } | |
| if(fis.indexOf(v) == fis.length-1){ | |
| boilingIngredients.gramme = "μ΄ "+boilingIngredients.gramme; | |
| } | |
| } | |
| return await Future<void>.delayed(Duration(seconds: 1), () async{ | |
| print("${boilingIngredients.productName}(${boilingIngredients.gramme})μ ${this.water.productName} ${this.water.gramme}μ ${isAdd ? 'ν¨κ» ': ''}λ£κ³ ${min}λΆ λμ λλ€."); | |
| print("π₯"*min); | |
| }); | |
| } | |
| Future<void> cCutting({required List<FoodIngredient> ingredients}) async{ | |
| String result = ingredients.map<String>((FoodIngredient fi) => "${fi.productName}(${fi.gramme})").toList().join(','); | |
| await Future.delayed(Duration(seconds: 1), () async{ | |
| print("πͺ$result(λ€)μ μλ¦ λλ€."); | |
| print("πͺπͺπͺ"); | |
| }); | |
| return; | |
| } | |
| Future<void> showFoodIngredient() async{ | |
| print("--------------π μ¬λ£ μ€λΉ-------------"); | |
| print("π "+this.meats.map<String>((FoodIngredient fi) => "${fi.productName}(${fi.gramme})").toList().join(',')); | |
| print("π₯¦ "+this.vegetables.map<String>((FoodIngredient fi) => "${fi.productName}(${fi.gramme})").toList().join(',')); | |
| print("π§ "+this.spices.map<String>((FoodIngredient fi) => "${fi.productName}(${fi.gramme})").toList().join(',')); | |
| print("-------------------------------------"); | |
| return await Future<void>.delayed(Duration(seconds: 1), (){}); | |
| } | |
| } | |
| class KimchiJji extends Jjigae{ | |
| KimchiJji({ | |
| required String name, | |
| required FoodIngredient water, | |
| required List<FoodIngredient> spices, | |
| required List<FoodIngredient> vegetables, | |
| required List<FoodIngredient> meats | |
| }) : super(name, water, spices, vegetables, meats); | |
| @override | |
| Future<void> boiling() async{ | |
| await this.cboiling(fis: this.meats, min: 3); | |
| await this.cboiling(fis: this.vegetables, min: 3); | |
| } | |
| @override | |
| Future<void> cutting() async{ | |
| await this.cCutting(ingredients: this.meats); | |
| await this.cCutting(ingredients: this.vegetables); | |
| } | |
| } | |
| class BuJJi extends Jjigae{ | |
| final List<FoodIngredient> seafoods; | |
| BuJJi({ | |
| required this.seafoods, | |
| required String name, | |
| required FoodIngredient water, | |
| required List<FoodIngredient> spices, | |
| required List<FoodIngredient> vegetables, | |
| required List<FoodIngredient> meats}) : super(name, water, spices, vegetables, meats); | |
| @override | |
| Future<void> boiling() async{ | |
| await this.cboiling(fis: this.seafoods, min: 4); | |
| await this.cboiling(fis: this.meats, min: 3); | |
| await this.cboiling(fis: this.vegetables, min: 3); | |
| } | |
| @override | |
| Future<void> cutting() async{ | |
| print("πͺ π¦π¦ππ ${this.seafoods.map<String>((FoodIngredient fi) => fi.productName).toList().join(',')}λ€μ μμ§ν©λλ€"); | |
| print("πͺπͺπͺ"); | |
| await this.cCutting(ingredients: this.meats); | |
| await this.cCutting(ingredients: this.vegetables); | |
| } | |
| @override | |
| Future<void> showFoodIngredient() async{ | |
| await super.showFoodIngredient(); | |
| print("+++ π¦π¦ππ ${this.seafoods.map<String>((FoodIngredient fi) => fi.productName).toList().join(',')}"); | |
| print("-------------------------------------"); | |
| return await Future<void>.delayed(Duration(seconds: 1), () {}); | |
| } | |
| } | |
| class Sundubu extends Jjigae{ | |
| final List<FoodIngredient> seafoods; | |
| Sundubu({ | |
| required this.seafoods, | |
| required String name, | |
| required FoodIngredient water, | |
| required List<FoodIngredient> spices, | |
| required List<FoodIngredient> vegetables, | |
| required List<FoodIngredient> meats}) : super(name, water, spices, vegetables, meats); | |
| @override | |
| Future<void> boiling() async{ | |
| await this.cboiling(fis: this.seafoods, min: 4); | |
| await this.cboiling(fis: this.meats, min: 3); | |
| await this.cboiling(fis: this.vegetables, min: 3); | |
| } | |
| @override | |
| Future<void> cutting() async{ | |
| print("πͺ π¦π¦ππ ${this.seafoods.map<String>((FoodIngredient fi) => fi.productName).toList().join(',')}λ€μ μμ§ν©λλ€"); | |
| print("πͺπͺπͺ"); | |
| await this.cCutting(ingredients: this.meats); | |
| await this.cCutting(ingredients: this.vegetables); | |
| } | |
| @override | |
| Future<void> showFoodIngredient() async{ | |
| await super.showFoodIngredient(); | |
| print("+++ π¦π¦ππ ${this.seafoods.map<String>((FoodIngredient fi) => fi.productName).toList().join(',')}"); | |
| print("-------------------------------------"); | |
| return await Future<void>.delayed(Duration(seconds: 1), () {}); | |
| } | |
| } | |
| class Sys extends StatelessWidget { | |
| const Sys({Key? key}) : super(key: key); | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| home: Main(), | |
| ); | |
| } | |
| } | |
| class Main extends StatefulWidget { | |
| Main({Key? key}) : super(key: key); | |
| @override | |
| _MainState createState() => _MainState(); | |
| } | |
| class _MainState extends State<Main> { | |
| final Jjigae buJi = BuJJi( | |
| name: "π² λΆλμ°κ°", | |
| seafoods: [ | |
| FoodIngredient(productName: "μμ°", gramme: "30g"), | |
| ], | |
| water: FoodIngredient(productName: "μ¬κ³¨", gramme: "500g"), | |
| vegetables: [ | |
| FoodIngredient(productName: "μν", gramme: "30g"), | |
| FoodIngredient(productName: "λν", gramme: "30g"), | |
| ], | |
| spices: [ | |
| FoodIngredient(productName: "μκΈ", gramme: "10g"), | |
| FoodIngredient(productName: "νμΆ", gramme: "2g"), | |
| FoodIngredient(productName: "κ³ μΆ§κ°λ£¨", gramme: "10g"), | |
| FoodIngredient(productName: "κ³ μΆμ₯", gramme: "20g"), | |
| FoodIngredient(productName: "λμ₯", gramme: "5g"), | |
| ], | |
| meats: [ | |
| FoodIngredient(productName: "λΌμ§κ³ κΈ°_λͺ©μ΄", gramme: "100g"), | |
| FoodIngredient(productName: "μ€νΈ", gramme: "100g"), | |
| FoodIngredient(productName: "μμΈμ§", gramme: "100g"), | |
| ] | |
| ); | |
| final Jjigae kimchiJji = KimchiJji( | |
| name: "π² κΉμΉμ°κ°", | |
| water: FoodIngredient(productName: "μ¬κ³¨", gramme: "500g"), | |
| vegetables: [ | |
| FoodIngredient(productName: "μν", gramme: "30g"), | |
| FoodIngredient(productName: "λν", gramme: "30g"), | |
| ], | |
| spices: [ | |
| FoodIngredient(productName: "μκΈ", gramme: "10g"), | |
| FoodIngredient(productName: "νμΆ", gramme: "2g"), | |
| FoodIngredient(productName: "κ³ μΆ§κ°λ£¨", gramme: "10g"), | |
| FoodIngredient(productName: "κ³ μΆμ₯", gramme: "20g"), | |
| FoodIngredient(productName: "λμ₯", gramme: "5g"), | |
| ], | |
| meats: [ | |
| FoodIngredient(productName: "λΌμ§κ³ κΈ°_λͺ©μ΄", gramme: "100g"), | |
| FoodIngredient(productName: "μ°ΈμΉ", gramme: "100g"), | |
| FoodIngredient(productName: "μ€νΈ", gramme: "100g"), | |
| ] | |
| ); | |
| final Jjigae sundubu = Sundubu( | |
| name: "π² μλλΆμ°κ°", | |
| seafoods: [ | |
| FoodIngredient(productName: "μμ°", gramme: "30g"), | |
| FoodIngredient(productName: "λ°μ§λ½", gramme: "30g"), | |
| ], | |
| water: FoodIngredient(productName: "μ¬κ³¨", gramme: "500g"), | |
| vegetables: [ | |
| FoodIngredient(productName: "μν", gramme: "30g"), | |
| FoodIngredient(productName: "λν", gramme: "30g"), | |
| ], | |
| spices: [ | |
| FoodIngredient(productName: "μκΈ", gramme: "10g"), | |
| FoodIngredient(productName: "νμΆ", gramme: "2g"), | |
| FoodIngredient(productName: "κ³ μΆ§κ°λ£¨", gramme: "10g"), | |
| FoodIngredient(productName: "κ³ μΆμ₯", gramme: "20g"), | |
| FoodIngredient(productName: "λμ₯", gramme: "5g"), | |
| ], | |
| meats: [ | |
| FoodIngredient(productName: "λΌμ§κ³ κΈ°_λͺ©μ΄", gramme: "100g"), | |
| FoodIngredient(productName: "μλλΆ", gramme: "300g"), | |
| ] | |
| ); | |
| bool clickCheck = false; | |
| @override | |
| Widget build(BuildContext context) { | |
| return Scaffold( | |
| appBar: AppBar(title: Text("μ°κ°λ€λ€λ€ 03"),), | |
| body: IgnorePointer( | |
| ignoring: this.clickCheck, | |
| child: Container( | |
| width: MediaQuery.of(context).size.width, | |
| child: Column( | |
| mainAxisAlignment: MainAxisAlignment.spaceEvenly, | |
| children: [this.buJi, this.kimchiJji, this.sundubu].map<Widget>( | |
| (Jjigae jjigea) => MaterialButton( | |
| color: Colors.blue, | |
| textColor: Colors.white, | |
| shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(20.0)), | |
| minWidth: 200.0, | |
| padding: EdgeInsets.symmetric(vertical: 10.0), | |
| child: Text(jjigea.name, style: TextStyle(fontSize: 20.0),), | |
| onPressed: () async{ | |
| setState(() { | |
| this.clickCheck = true; | |
| }); | |
| await jjigea.serve(); | |
| setState(() { | |
| this.clickCheck = false; | |
| }); | |
| }, | |
| ) | |
| ).toList(), | |
| ), | |
| ), | |
| ), | |
| ); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment