From 01e92c14abebbffe23698937fd911655c790b5e3 Mon Sep 17 00:00:00 2001 From: akhdanre Date: Sun, 27 Apr 2025 14:57:26 +0700 Subject: [PATCH] feat: add default value untuk option answer --- .../controller/quiz_creation_controller.dart | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/feature/quiz_creation/controller/quiz_creation_controller.dart b/lib/feature/quiz_creation/controller/quiz_creation_controller.dart index fbc5434..53be6a7 100644 --- a/lib/feature/quiz_creation/controller/quiz_creation_controller.dart +++ b/lib/feature/quiz_creation/controller/quiz_creation_controller.dart @@ -12,7 +12,7 @@ class QuizCreationController extends GetxController { RxBool isGenerate = true.obs; Rx currentQuestionType = QuestionType.fillTheBlank.obs; - RxList quizData = [QuestionData(index: 1)].obs; + RxList quizData = [QuestionData(index: 1, type: QuestionType.fillTheBlank)].obs; RxInt selectedQuizIndex = 0.obs; @override @@ -53,7 +53,11 @@ class QuizCreationController extends GetxController { // Listener perubahan tipe soal ever(currentQuestionType, (type) { if (quizData.isNotEmpty) { - _updateCurrentQuestion(type: type); + if (type == QuestionType.option) { + _updateCurrentQuestion(type: type, correctAnswerIndex: 0); + } else { + _updateCurrentQuestion(type: type, correctAnswerIndex: null); + } } });