Browse Source

fix: guider

pull/46/head
AmirrezaChegini 6 days ago
parent
commit
3eb3be9f1f
  1. 22
      lib/core/widgets/answer_box/answer_box.dart
  2. 39
      lib/features/question/presentation/ui/screens/question_screen.dart

22
lib/core/widgets/answer_box/answer_box.dart

@ -16,6 +16,7 @@ class AnswerBox extends StatefulWidget {
required this.correctAnswer, required this.correctAnswer,
required this.index, required this.index,
required this.globalKey, required this.globalKey,
required this.answerGlobalKey,
this.onTap, this.onTap,
this.onNotifTap, this.onNotifTap,
}); });
@ -26,6 +27,7 @@ class AnswerBox extends StatefulWidget {
final int index; final int index;
final Function(AnswerEntity answer)? onNotifTap; final Function(AnswerEntity answer)? onNotifTap;
final GlobalKey globalKey; final GlobalKey globalKey;
final GlobalKey answerGlobalKey;
@override @override
State<AnswerBox> createState() => _AnswerBoxState(); State<AnswerBox> createState() => _AnswerBoxState();
@ -55,14 +57,18 @@ class _AnswerBoxState extends State<AnswerBox> {
child: Stack( child: Stack(
alignment: Alignment.topCenter, alignment: Alignment.topCenter,
children: [ 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( Positioned(
left: 0, left: 0,

39
lib/features/question/presentation/ui/screens/question_screen.dart

@ -161,27 +161,24 @@ class _QuestionScreenState extends State<QuestionScreen> with TickerProviderStat
key: Key('${state.currentQuestion?.id}'), key: Key('${state.currentQuestion?.id}'),
controller: context.read<QuestionBloc>().answerAnimationController, controller: context.read<QuestionBloc>().answerAnimationController,
index: index, index: index,
child: MyShowcaseWidget(
globalKey: context.read<QuestionBloc>().showCaseKey['answer_key_$index']!,
description: context.translate.showcase_answer,
child: AnswerBox(
globalKey: context.read<QuestionBloc>().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<QuestionBloc>().showAnswerDialog(
context: context,
answerEntity: answer,
);
},
onTap: (isCorrect, correctAnswer) =>
context.read<QuestionBloc>().add(
ChooseAnswerEvent(isCorrect, correctAnswer, context),
),
),
child: AnswerBox(
globalKey: context.read<QuestionBloc>().showCaseKey['notif_key_$index']!,
answerGlobalKey: context.read<QuestionBloc>().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<QuestionBloc>().showAnswerDialog(
context: context,
answerEntity: answer,
);
},
onTap: (isCorrect, correctAnswer) =>
context.read<QuestionBloc>().add(
ChooseAnswerEvent(isCorrect, correctAnswer, context),
),
), ),
), ),
), ),

Loading…
Cancel
Save