From 576f5b27ea82ecaecf8e54f4e2b577a7ba7cac17 Mon Sep 17 00:00:00 2001 From: akhdanre Date: Sat, 7 Jun 2025 14:35:48 +0700 Subject: [PATCH] feat: penyesuaian pada beberapa logic component --- assets/translations/en-US.json | 4 ++-- lib/core/endpoint/api_endpoint.dart | 4 ++-- .../join_room/controller/join_room_controller.dart | 2 +- .../controller/quiz_creation_controller.dart | 2 ++ .../quiz_preview/controller/quiz_preview_controller.dart | 3 +++ .../room_maker/controller/room_maker_controller.dart | 8 ++++++++ 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/assets/translations/en-US.json b/assets/translations/en-US.json index ef0aed4..1d589f6 100644 --- a/assets/translations/en-US.json +++ b/assets/translations/en-US.json @@ -38,8 +38,8 @@ "library_title": "Quiz Library", "library_description": "A collection of quiz questions created for study.", "no_quiz_available": "No quizzes available yet.", - "quiz_count_label": "Quizzes", - "quiz_count_named": "{total} Quizzes", + "quiz_count_label": "Quiz", + "quiz_count_named": "{total} Quiz", "history_title": "Quiz History", "history_subtitle": "Review the quizzes you've taken", diff --git a/lib/core/endpoint/api_endpoint.dart b/lib/core/endpoint/api_endpoint.dart index 9cfcf74..bd4e5ee 100644 --- a/lib/core/endpoint/api_endpoint.dart +++ b/lib/core/endpoint/api_endpoint.dart @@ -1,6 +1,6 @@ class APIEndpoint { - static const String baseUrl = "http://192.168.1.13:5000"; - // static const String baseUrl = "http://103.193.178.121:5000"; + // static const String baseUrl = "http://192.168.1.13:5000"; + static const String baseUrl = "http://103.193.178.121:5000"; static const String api = "$baseUrl/api"; static const String login = "/login"; diff --git a/lib/feature/join_room/controller/join_room_controller.dart b/lib/feature/join_room/controller/join_room_controller.dart index e099164..c03e583 100644 --- a/lib/feature/join_room/controller/join_room_controller.dart +++ b/lib/feature/join_room/controller/join_room_controller.dart @@ -56,7 +56,7 @@ class JoinRoomController extends GetxController { final Map sessionInfoJson = dataPayload["session_info"]; final Map quizInfoJson = dataPayload["quiz_info"]; - // CustomFloatingLoading.showLoading(context); + CustomFloatingLoading.hideLoading(); Get.toNamed( AppRoutes.waitRoomPage, arguments: WaitingRoomDTO( diff --git a/lib/feature/quiz_creation/controller/quiz_creation_controller.dart b/lib/feature/quiz_creation/controller/quiz_creation_controller.dart index cd47fc5..ad9e2ec 100644 --- a/lib/feature/quiz_creation/controller/quiz_creation_controller.dart +++ b/lib/feature/quiz_creation/controller/quiz_creation_controller.dart @@ -280,6 +280,8 @@ class QuizCreationController extends GetxController { CustomFloatingLoading.hideLoading(); isGenerate.value = false; + inputSentenceTC.text = ""; + if (quizData.isNotEmpty && selectedQuizIndex.value == 0) { final data = quizData[0]; questionTC.text = data.question ?? ""; diff --git a/lib/feature/quiz_preview/controller/quiz_preview_controller.dart b/lib/feature/quiz_preview/controller/quiz_preview_controller.dart index c13dbfb..08f4711 100644 --- a/lib/feature/quiz_preview/controller/quiz_preview_controller.dart +++ b/lib/feature/quiz_preview/controller/quiz_preview_controller.dart @@ -96,6 +96,7 @@ class QuizPreviewController extends GetxController { title: 'Error', message: 'Jumlah soal harus 10 atau lebih', ); + return; } @@ -124,9 +125,11 @@ class QuizPreviewController extends GetxController { message: 'Kuis berhasil disimpan!', ); + CustomFloatingLoading.hideLoading(); Get.offAllNamed(AppRoutes.mainPage, arguments: 2); } } catch (e) { + CustomFloatingLoading.hideLoading(); logC.e(e); } finally { isLoading.value = false; diff --git a/lib/feature/room_maker/controller/room_maker_controller.dart b/lib/feature/room_maker/controller/room_maker_controller.dart index c64c2ac..a073204 100644 --- a/lib/feature/room_maker/controller/room_maker_controller.dart +++ b/lib/feature/room_maker/controller/room_maker_controller.dart @@ -106,6 +106,14 @@ class RoomMakerController extends GetxController { return; } + if (int.tryParse(maxPlayerTC.text) == null) { + CustomNotification.error( + title: "Input tidak valid", + message: "Jumlah pemain harus berupa angka tanpa karakter huruf atau simbol.", + ); + return; + } + if (!await _connectionService.isHaveConnection()) { ConnectionNotification.noInternedConnection(); return;