diff --git a/lib/core/widgets/showcase/my_showcase_widget.dart b/lib/core/widgets/showcase/my_showcase_widget.dart index afd7062..75ec9d5 100644 --- a/lib/core/widgets/showcase/my_showcase_widget.dart +++ b/lib/core/widgets/showcase/my_showcase_widget.dart @@ -128,7 +128,7 @@ class MyShowcaseWidget extends StatelessWidget { Expanded( child: MyInkwell( onTap: () { - ShowcaseView.get().unregister(); + ShowcaseView.get().dismiss(); }, splashColor: MyColors.transparent, highlightColor: MyColors.transparent, diff --git a/lib/features/question/presentation/bloc/question_bloc.dart b/lib/features/question/presentation/bloc/question_bloc.dart index c52f32b..764bc91 100644 --- a/lib/features/question/presentation/bloc/question_bloc.dart +++ b/lib/features/question/presentation/bloc/question_bloc.dart @@ -33,6 +33,7 @@ class QuestionBloc extends Bloc { ) : super(QuestionState()) { volumeStream = _mainAudioService.volumeStream(); playingStream = _mainAudioService.playingStream(); + // LocalStorage.saveData(key: MyConstants.firstShowcase, value: 'false'); initAudios(); registerShowCase(); on(_getLevelEvent); @@ -82,6 +83,12 @@ class QuestionBloc extends Bloc { onStart: (showcaseIndex, key) { LocalStorage.saveData(key: MyConstants.firstShowcase, value: 'true'); }, + onDismiss: (onDismiss) async { + await playQuestionAudio(); + }, + onFinish: () async { + await playQuestionAudio(); + }, ); } catch (_) {} } @@ -237,10 +244,15 @@ class QuestionBloc extends Bloc { currentQuestion: data.questions?.first, showAnswers: true )); - await playQuestionAudio(); - animationController.forward().then((value) { - startShowcase(); - }); + if(LocalStorage.readData(key: MyConstants.firstShowcase) != 'true'){ + await Future.delayed(Duration(milliseconds: 500)); + animationController.forward().then((value) { + startShowcase(); + }); + } else { + await playQuestionAudio(); + animationController.forward(); + } }, (error) { emit(state.copyWith(getQuestionStatus: BaseError(error.errorMessage))); diff --git a/lib/features/question/presentation/ui/screens/answer_screen.dart b/lib/features/question/presentation/ui/screens/answer_screen.dart index a1ac4c9..3360efd 100644 --- a/lib/features/question/presentation/ui/screens/answer_screen.dart +++ b/lib/features/question/presentation/ui/screens/answer_screen.dart @@ -71,6 +71,12 @@ class _AnswerScreenState extends State { await audioService.play(); } + @override + void dispose() { + audioService.pause(); + super.dispose(); + } + @override Widget build(BuildContext context) { return Stack( @@ -90,6 +96,13 @@ class _AnswerScreenState extends State { ), ), ), + if (widget.showConfetti) ...{ + Lottie.asset( + MyAnimations.confetti, + height: context.heightScreen, + fit: BoxFit.cover, + ), + }, Positioned( bottom: setPlatform(android: MySpaces.s30, iOS: MySpaces.s12), child: TextButton( @@ -105,13 +118,6 @@ class _AnswerScreenState extends State { ), ), ), - if (widget.showConfetti) ...{ - Lottie.asset( - MyAnimations.confetti, - height: context.heightScreen, - fit: BoxFit.cover, - ), - }, ], ); }