diff --git a/front/capstone_front/lib/models/cafeteria_menu_model.dart b/front/capstone_front/lib/models/cafeteria_menu_model.dart index 83cd7680f5..ad9bcc85cd 100644 --- a/front/capstone_front/lib/models/cafeteria_menu_model.dart +++ b/front/capstone_front/lib/models/cafeteria_menu_model.dart @@ -18,6 +18,14 @@ class CafeteriaMenuModel { "Dormitory Cafeteria (Dormitory A, 1st floor)", "Dormitory Cafeteria (Dormitory Building A, 1st floor)", ]; + List cafeteriaZh = [ + "Hanwool 餐厅(法律大厦 B1F)", + "学生餐厅(福利大楼 1F)", + "员工餐厅(福利大楼 1F)", + "清香韩国餐厅(法律大厦 5 楼)", + "呈祥中厅(法律大厦 5 楼)", + "宿舍餐厅(宿舍楼 A 座 1 楼)", + ]; void addFunc( var data, List> targetList, String type, String addName) { @@ -29,6 +37,17 @@ class CafeteriaMenuModel { int tmp1 = 0; // []가 2번 이상 나오면 줄바꿈 int tmp2 = 0; + tmpMenu = tmpMenu.replaceAll('ë\'˜)', ''); + tmpMenu = tmpMenu.replaceAll('ï', ''); + tmpMenu = tmpMenu.replaceAll('ë', ''); + tmpMenu = tmpMenu.replaceAll('\'', ''); + tmpMenu = tmpMenu.replaceAll('˜', ''); + tmpMenu = tmpMenu.replaceAll('ì', ''); + tmpMenu = tmpMenu.replaceAll('š', ''); + tmpMenu = tmpMenu.replaceAll('¿', ''); + tmpMenu = tmpMenu.replaceAll('¦', ''); + tmpMenu = tmpMenu.replaceAll('´', ''); + tmpMenu = tmpMenu.replaceAll('¬', ''); for (int i = 0; i < tmpMenu.length; i++) { if (tmpMenu[i] == '※') { tmp1 += 1; @@ -42,9 +61,6 @@ class CafeteriaMenuModel { tmpMenu = '${tmpMenu.substring(0, i)}\n${tmpMenu.substring(i)}'; i += 2; } - } else if (tmpMenu[i] == 'ï') { - tmpMenu = '${tmpMenu.substring(0, i)}${tmpMenu.substring(i + 3)}'; - i += 2; } if (tmp1 == 2) { tmp1 = 0; @@ -102,14 +118,14 @@ class CafeteriaMenuModel { void addDataEn(int cafeteriaIndex, var data) { List> tmpList = []; if (cafeteriaIndex == 0) { - addFunc(data, tmpList, "1Corner\u003Cbr\u003ESNACK1", "Corner1 SNACK1"); - addFunc(data, tmpList, "1Corner\u003Cbr\u003ESNACK2", "Corner1 SNACK2"); - addFunc(data, tmpList, "2Corner\u003CBR\u003ENOODLE", "Corner2 NOODLE"); - addFunc(data, tmpList, "3Corner\u003Cbr\u003ECUTLET", "Corner3 CUTLET"); - addFunc( - data, tmpList, "4Corner\u003Cbr\u003ERICE.Oven", "Corner4 RICE.Oven"); + addFunc(data, tmpList, "1Corner\u003Cbr\u003ESNACK1", "Corner 1 SNACK1"); + addFunc(data, tmpList, "1Corner\u003Cbr\u003ESNACK2", "Corner 1 SNACK2"); + addFunc(data, tmpList, "2Corner\u003CBR\u003ENOODLE", "Corner 2 NOODLE"); + addFunc(data, tmpList, "3Corner\u003Cbr\u003ECUTLET", "Corner 3 CUTLET"); + addFunc(data, tmpList, "4Corner\u003Cbr\u003ERICE.Oven", + "Corner 4 RICE.Oven"); addFunc(data, tmpList, "5Corner\u003Cbr\u003EGUKBAP.Chef", - "Corner5 GUKBAP.Chef"); + "Corner 5 GUKBAP.Chef"); } else if (cafeteriaIndex == 1) { addFunc(data, tmpList, "Good Morning", "Good Morning"); addFunc(data, tmpList, "Breakfast for a Thousand", @@ -125,15 +141,15 @@ class CafeteriaMenuModel { addFunc(data, tmpList, "Dinner I", "Dinner Ⅰ"); addFunc(data, tmpList, "Dinner II", "Dinner Ⅱ"); } else if (cafeteriaIndex == 2) { - addFunc(data, tmpList, "Kitchen1", "Kitchen1"); - addFunc(data, tmpList, "Kitchen2", "Kitchen2"); + addFunc(data, tmpList, "Kitchen1", "Kitchen 1"); + addFunc(data, tmpList, "Kitchen2", "Kitchen 2"); addFunc(data, tmpList, "Today's\u003Cbr\u003ESalad", "Today's Salad"); addFunc(data, tmpList, "Dinner", "Dinner"); } else if (cafeteriaIndex == 3) { - addFunc(data, tmpList, "Menu1", "Menu1"); - addFunc(data, tmpList, "Menu2", "Menu2"); - addFunc(data, tmpList, "Menu3", "Menu3"); - addFunc(data, tmpList, "Menu4", "Menu4"); + addFunc(data, tmpList, "Menu1", "Menu 1"); + addFunc(data, tmpList, "Menu2", "Menu 2"); + addFunc(data, tmpList, "Menu3", "Menu 3"); + addFunc(data, tmpList, "Menu4", "Menu 4"); } else if (cafeteriaIndex == 4) { addFunc(data, tmpList, "PASTA", "PASTA"); addFunc(data, tmpList, "RICE", "RISOTTO"); @@ -148,9 +164,58 @@ class CafeteriaMenuModel { cafeteriaMenus.add(tmpList); } + void addDataZh(int cafeteriaIndex, var data) { + List> tmpList = []; + if (cafeteriaIndex == 0) { + addFunc(data, tmpList, "1角\u003Cbr\u003ESNACK1", "Corner 1 SNACK1"); + addFunc(data, tmpList, "1角\u003CBR\u003ENOODLE", "Corner 1 SNACK2"); + addFunc(data, tmpList, "2角\u003CBR\u003ENOODLE", "Corner 2 NOODLE"); + addFunc(data, tmpList, "3角\u003Cbr\u003E小刀", "Corner 3 CUTLET"); + addFunc(data, tmpList, "4Corner\u003Cbr\u003ERICE.Oven", + "Corner 4 RICE.Oven"); + addFunc(data, tmpList, "5Corner\u003Cbr\u003EGUKBAP.Chef", + "Corner 5 GUKBAP.Chef"); + } else if (cafeteriaIndex == 1) { + addFunc(data, tmpList, "天苑早餐", "天苑早餐"); + addFunc(data, tmpList, "Breakfast for a Thousand", + "Breakfast for a Thousand"); + addFunc(data, tmpList, "伽马\u003Cbr\u003E午餐", "Kama lunch"); + addFunc(data, tmpList, "每日膳食\u003Cbr\u003E午餐", "DailyBop Lunch"); + addFunc( + data, tmpList, "Vegetarian\u003Cbr\u003EMedium", "Vegiterian Lunch"); + addFunc(data, tmpList, "国际大厨\u003Cbr\u003E午餐", "InterChef Lunch"); + addFunc(data, tmpList, "面颂\u003Cbr\u003E午餐", "NoodleSong Lunch"); + addFunc(data, tmpList, "晚餐Ⅰ", "Dinner Ⅰ"); + addFunc(data, tmpList, "晚餐 II", "Dinner Ⅱ"); + } else if (cafeteriaIndex == 2) { + addFunc(data, tmpList, "厨房1", "Kitchen 1"); + addFunc(data, tmpList, "厨房2", "Kitchen 2"); + addFunc(data, tmpList, "今日沙拉", "今日沙拉"); + addFunc(data, tmpList, "晚餐", "晚餐"); + } else if (cafeteriaIndex == 3) { + addFunc(data, tmpList, "菜单1", "菜单 1"); + addFunc(data, tmpList, "菜单2", "菜单 2"); + addFunc(data, tmpList, "菜单3", "菜单 3"); + addFunc(data, tmpList, "菜单4", "菜单 4"); + } else if (cafeteriaIndex == 4) { + addFunc(data, tmpList, "意大利面", "PASTA"); + addFunc(data, tmpList, "里索托", "RISOTTO"); + addFunc(data, tmpList, "牛排", "STEAK"); + } else if (cafeteriaIndex == 5) { + addFunc(data, tmpList, "午餐", "午餐"); + cafeteriaMenus.add(tmpList); + tmpList = []; + if (data != null && data["晚餐"] != null) { + tmpList.add(["晚餐", data["晚餐"]["메뉴"], "仅限申请人"]); + } + } + cafeteriaMenus.add(tmpList); + } + CafeteriaMenuModel.fromJson( List json, String date, String language) { if (language == 'KO') { + // 한국어 for (int i = 0; i < cafeteriaKo.length; i++) { bool dataAdded = false; for (int j = 0; j < json.length; j++) { @@ -165,6 +230,7 @@ class CafeteriaMenuModel { } } } else if (language == 'EN-US') { + // 영어 for (int i = 0; i < cafeteriaEn.length; i++) { bool dataAdded = false; for (int j = 0; j < json.length; j++) { @@ -178,6 +244,21 @@ class CafeteriaMenuModel { cafeteriaMenus.add([]); } } + } else { + // 중국어 + for (int i = 0; i < cafeteriaZh.length; i++) { + bool dataAdded = false; + for (int j = 0; j < json.length; j++) { + if (json[j][cafeteriaZh[i]] != null) { + addDataZh(i, json[j][cafeteriaZh[i]][date]); + dataAdded = true; + break; + } + } + if (!dataAdded) { + cafeteriaMenus.add([]); + } + } } } } diff --git a/front/capstone_front/lib/screens/home/home_screen.dart b/front/capstone_front/lib/screens/home/home_screen.dart index 47dac3dbdc..0d3ea1fc98 100644 --- a/front/capstone_front/lib/screens/home/home_screen.dart +++ b/front/capstone_front/lib/screens/home/home_screen.dart @@ -144,17 +144,20 @@ class _HomeScreenState extends State fontSize: 24, fontWeight: FontWeight.w700, )), - IconButton( - icon: const Icon(Icons.add), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - const NoticeScreen(), - ), - ); - }, + Transform.translate( + offset: Offset(10, -10), + child: IconButton( + icon: const Icon(Icons.add), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + const NoticeScreen(), + ), + ); + }, + ), ), ], ), @@ -240,17 +243,20 @@ class _HomeScreenState extends State fontSize: 24, fontWeight: FontWeight.w700, )), - IconButton( - icon: const Icon(Icons.add), - onPressed: () { - Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - const CafeteriaMenuScreen(), - ), - ); - }, + Transform.translate( + offset: Offset(10, -10), + child: IconButton( + icon: const Icon(Icons.add), + onPressed: () { + Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + const CafeteriaMenuScreen(), + ), + ); + }, + ), ), ], ), diff --git a/front/capstone_front/lib/screens/signup/signup_service.dart b/front/capstone_front/lib/screens/signup/signup_service.dart index f99b40b2b1..327bfe73a4 100644 --- a/front/capstone_front/lib/screens/signup/signup_service.dart +++ b/front/capstone_front/lib/screens/signup/signup_service.dart @@ -29,7 +29,6 @@ Map userInfo = { 'department': '', 'country': '', }; -int selectedPageIndex = 0; Future signup() async { Map userData = { diff --git a/front/capstone_front/lib/services/speech_service.dart b/front/capstone_front/lib/services/speech_service.dart index 78f09f3b90..01891afd82 100644 --- a/front/capstone_front/lib/services/speech_service.dart +++ b/front/capstone_front/lib/services/speech_service.dart @@ -6,6 +6,7 @@ import 'package:capstone_front/models/speech_model.dart'; import 'package:flutter/services.dart'; import 'package:http/http.dart' as http; import 'package:flutter_dotenv/flutter_dotenv.dart'; +import 'package:http_parser/http_parser.dart'; import 'package:path_provider/path_provider.dart'; Future getSpeechResult(String filePath, String sentence) async { @@ -15,6 +16,8 @@ Future getSpeechResult(String filePath, String sentence) async { // Multipart request 생성 var request = http.MultipartRequest('POST', url); + request.headers['Content-Type'] = 'multipart/form-data'; + var file = File.fromUri(Uri.parse(filePath)); // 오디오 파일 추가 var audioStream = http.ByteStream(file.openRead()); @@ -28,7 +31,18 @@ Future getSpeechResult(String filePath, String sentence) async { var data = { 'context': sentence, }; - request.fields.addAll(data); + + // JSON 데이터를 UTF-8로 인코딩하여 바이트로 변환 후 MultipartFile로 추가 + List jsonData = utf8.encode(jsonEncode(data)); + request.files.add(http.MultipartFile.fromBytes( + 'context', + jsonData, + contentType: MediaType( + 'application', + 'json', + {'charset': 'utf-8'}, + ), + )); // 요청 보내기 var streamResponse = await request.send();