From 39e7068aa8b06597aa69113046047b7b212af0dc Mon Sep 17 00:00:00 2001 From: Muktazam Hasbi Ashidiqi Date: Tue, 26 Mar 2024 16:44:02 +0700 Subject: [PATCH] fix: quiz: show save answer for short andwer type --- .../presentation/bloc/quiz_exercise_cubit.dart | 4 ++++ .../presentation/pages/task_dialog.dart | 13 +++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_cubit.dart b/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_cubit.dart index 51e95ab..10442c8 100644 --- a/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_cubit.dart +++ b/app/lib/features/quiz_exercise/presentation/bloc/quiz_exercise_cubit.dart @@ -77,6 +77,10 @@ class QuizExerciseCubit extends Cubit { quizExercise.type == 'SHORT_ANSWER') .toList(); + problemIdList = problemList + .map((quizExercise) => quizExercise.id) // Extracting ids + .toList(); + // TODO(someone): fix the check logic later // if (weeklyQuizParticipant.attempts.isEmpty) { answerList = problemList diff --git a/app/lib/features/quiz_exercise/presentation/pages/task_dialog.dart b/app/lib/features/quiz_exercise/presentation/pages/task_dialog.dart index 6be7730..5cdc436 100644 --- a/app/lib/features/quiz_exercise/presentation/pages/task_dialog.dart +++ b/app/lib/features/quiz_exercise/presentation/pages/task_dialog.dart @@ -46,7 +46,7 @@ class TaskDialog extends StatelessWidget { // ), // ), // if (!preview) - ...task.question.options!.asMap().entries.map((e) { + ...task.question.options.asMap().entries.map((e) { final current = String.fromCharCode(65 + e.key); return RadioListTile( @@ -85,9 +85,14 @@ class TaskDialog extends StatelessWidget { task.type == 'SHORT_ANSWER' ? Container( padding: const EdgeInsets.only(top: 20), - child: CustomTextField('Jawaban anda', (value) { - context.read().fillAnswer(value); - }, (p0) => null, ''), + child: CustomTextField( + 'Jawaban anda', + (value) { + context.read().fillAnswer(value); + }, + (p0) => null, + answer, + ), ) : Container(), if (!preview)