From 3eb3be9f1f79e1230c6c10f0a2d3f2781f2f8cb0 Mon Sep 17 00:00:00 2001 From: AmirrezaChegini Date: Tue, 2 Dec 2025 22:11:01 +0330 Subject: [PATCH] fix: guider --- lib/core/widgets/answer_box/answer_box.dart | 22 +++++++---- .../ui/screens/question_screen.dart | 39 +++++++++---------- 2 files changed, 32 insertions(+), 29 deletions(-) diff --git a/lib/core/widgets/answer_box/answer_box.dart b/lib/core/widgets/answer_box/answer_box.dart index 0e85ce9..148e81c 100644 --- a/lib/core/widgets/answer_box/answer_box.dart +++ b/lib/core/widgets/answer_box/answer_box.dart @@ -16,6 +16,7 @@ class AnswerBox extends StatefulWidget { required this.correctAnswer, required this.index, required this.globalKey, + required this.answerGlobalKey, this.onTap, this.onNotifTap, }); @@ -26,6 +27,7 @@ class AnswerBox extends StatefulWidget { final int index; final Function(AnswerEntity answer)? onNotifTap; final GlobalKey globalKey; + final GlobalKey answerGlobalKey; @override State createState() => _AnswerBoxState(); @@ -55,14 +57,18 @@ class _AnswerBoxState extends State { child: Stack( alignment: Alignment.topCenter, children: [ - AnswerPictureBox( - selected: selected, - index: widget.index, - image: widget.answer.image ?? '', - correctAnswer: widget.correctAnswer, - onTap: () { - widget.onNotifTap?.call(widget.answer); - }, + MyShowcaseWidget( + globalKey: widget.answerGlobalKey, + description: context.translate.showcase_answer, + child: AnswerPictureBox( + selected: selected, + index: widget.index, + image: widget.answer.image ?? '', + correctAnswer: widget.correctAnswer, + onTap: () { + widget.onNotifTap?.call(widget.answer); + }, + ), ), Positioned( left: 0, diff --git a/lib/features/question/presentation/ui/screens/question_screen.dart b/lib/features/question/presentation/ui/screens/question_screen.dart index b9012d4..39a4892 100644 --- a/lib/features/question/presentation/ui/screens/question_screen.dart +++ b/lib/features/question/presentation/ui/screens/question_screen.dart @@ -161,27 +161,24 @@ class _QuestionScreenState extends State with TickerProviderStat key: Key('${state.currentQuestion?.id}'), controller: context.read().answerAnimationController, index: index, - child: MyShowcaseWidget( - globalKey: context.read().showCaseKey['answer_key_$index']!, - description: context.translate.showcase_answer, - child: AnswerBox( - globalKey: context.read().showCaseKey['notif_key_$index']!, - index: state.currentQuestion?.answers?[index].order ?? 1, - answer: - state.currentQuestion?.answers?[index] ?? - AnswerEntity(), - correctAnswer: state.currentQuestion?.correctAnswer ?? 0, - onNotifTap: (AnswerEntity answer) { - context.read().showAnswerDialog( - context: context, - answerEntity: answer, - ); - }, - onTap: (isCorrect, correctAnswer) => - context.read().add( - ChooseAnswerEvent(isCorrect, correctAnswer, context), - ), - ), + child: AnswerBox( + globalKey: context.read().showCaseKey['notif_key_$index']!, + answerGlobalKey: context.read().showCaseKey['answer_key_$index']!, + index: state.currentQuestion?.answers?[index].order ?? 1, + answer: + state.currentQuestion?.answers?[index] ?? + AnswerEntity(), + correctAnswer: state.currentQuestion?.correctAnswer ?? 0, + onNotifTap: (AnswerEntity answer) { + context.read().showAnswerDialog( + context: context, + answerEntity: answer, + ); + }, + onTap: (isCorrect, correctAnswer) => + context.read().add( + ChooseAnswerEvent(isCorrect, correctAnswer, context), + ), ), ), ),