feat: add default value untuk option answer
This commit is contained in:
parent
9db744679d
commit
01e92c14ab
|
@ -12,7 +12,7 @@ class QuizCreationController extends GetxController {
|
||||||
|
|
||||||
RxBool isGenerate = true.obs;
|
RxBool isGenerate = true.obs;
|
||||||
Rx<QuestionType> currentQuestionType = QuestionType.fillTheBlank.obs;
|
Rx<QuestionType> currentQuestionType = QuestionType.fillTheBlank.obs;
|
||||||
RxList<QuestionData> quizData = <QuestionData>[QuestionData(index: 1)].obs;
|
RxList<QuestionData> quizData = <QuestionData>[QuestionData(index: 1, type: QuestionType.fillTheBlank)].obs;
|
||||||
RxInt selectedQuizIndex = 0.obs;
|
RxInt selectedQuizIndex = 0.obs;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@ -53,7 +53,11 @@ class QuizCreationController extends GetxController {
|
||||||
// Listener perubahan tipe soal
|
// Listener perubahan tipe soal
|
||||||
ever<QuestionType>(currentQuestionType, (type) {
|
ever<QuestionType>(currentQuestionType, (type) {
|
||||||
if (quizData.isNotEmpty) {
|
if (quizData.isNotEmpty) {
|
||||||
_updateCurrentQuestion(type: type);
|
if (type == QuestionType.option) {
|
||||||
|
_updateCurrentQuestion(type: type, correctAnswerIndex: 0);
|
||||||
|
} else {
|
||||||
|
_updateCurrentQuestion(type: type, correctAnswerIndex: null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue