From 3015d05a4c35f6a584488cb2768b944dd01c3107 Mon Sep 17 00:00:00 2001 From: JoaoAlmeida-dev <joao.ranger@gmail.com> Date: Thu, 16 Mar 2023 21:32:52 +0000 Subject: [PATCH] fixed quiz size on start a new attemp case --- lib/pages/quiz/quiz.dart | 15 +++++++++++---- lib/pages/quiz/quiz_list_menu.dart | 2 +- lib/pages/quiz/quiz_page.dart | 4 ++-- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/lib/pages/quiz/quiz.dart b/lib/pages/quiz/quiz.dart index 8fdb42ca..a2ecd625 100644 --- a/lib/pages/quiz/quiz.dart +++ b/lib/pages/quiz/quiz.dart @@ -21,7 +21,7 @@ class Quiz extends StatefulWidget { final int quizNumber; final int numQuestions; - Quiz({ + const Quiz({ Key? key, required this.trialNumber, required this.quizNumber, @@ -82,7 +82,11 @@ class _QuizState extends State<Quiz> { Map answer = {"choices": selectedAnswerIds}; LoggerService.instance.debug(answer.toString()); submitted = await QuizService.answerQuestion( - widget.quizNumber, widget.trialNumber, question, answer); + widget.quizNumber, + widget.trialNumber, + question, + answer, + ); if (submitted) { timer?.cancel(); } @@ -159,8 +163,11 @@ class _QuizState extends State<Quiz> { Text( "${AppLocalizations.of(context)!.quizPointsOfTrial}: ${response["trial_score"]}"), DynamicTextButton( - onPressed: Navigator.of(context).pop, - child: Text(AppLocalizations.of(context)!.back)), + onPressed: Navigator.of(context).pop, + child: Text( + AppLocalizations.of(context)!.back, + ), + ), ], ), ); diff --git a/lib/pages/quiz/quiz_list_menu.dart b/lib/pages/quiz/quiz_list_menu.dart index b96065d5..f8654281 100644 --- a/lib/pages/quiz/quiz_list_menu.dart +++ b/lib/pages/quiz/quiz_list_menu.dart @@ -77,7 +77,7 @@ class _QuizListState extends State<QuizList> { isTrialLoading = false; int newTrialNumber = newTrialInfo["trial_number"]; - int numQuestions = newTrialInfo["numQuestions"] ?? 1000; + int numQuestions = newTrialInfo["quiz_size"] ?? 0; LoggerService.instance.debug(newTrialInfo); if (mounted) { Navigator.of(context) diff --git a/lib/pages/quiz/quiz_page.dart b/lib/pages/quiz/quiz_page.dart index ddfd575f..02eb510c 100644 --- a/lib/pages/quiz/quiz_page.dart +++ b/lib/pages/quiz/quiz_page.dart @@ -6,7 +6,7 @@ import '../../widgets/dialogs/CustomDialogs.dart'; //Main for isolated testing void main() { - runApp(MaterialApp( + runApp(const MaterialApp( home: QuizPage( quizNumber: 1, trialNumber: 1, @@ -21,7 +21,7 @@ class QuizPage extends StatefulWidget { final int trialNumber; final int numQuestions; - QuizPage({ + const QuizPage({ Key? key, required this.quizNumber, required this.trialNumber,