diff --git a/lib/features/language/presentation/ui/language_page.dart b/lib/features/language/presentation/ui/language_page.dart index bdaeba2..811c017 100644 --- a/lib/features/language/presentation/ui/language_page.dart +++ b/lib/features/language/presentation/ui/language_page.dart @@ -43,8 +43,8 @@ class LanguagePage extends StatelessWidget { ), child: Padding( padding: EdgeInsets.only( - left: setSize(context: context, mobile: 60, tablet: 0.3.w) ?? 0, - right: setSize(context: context, mobile: 60, tablet: 0.3.w) ?? 0, + left: setSize(context: context, mobile: 50, tablet: 0.3.w) ?? 0, + right: setSize(context: context, mobile: 50, tablet: 0.3.w) ?? 0, bottom: MySpaces.s40, top: 100, ), diff --git a/lib/features/question/presentation/bloc/question_bloc.dart b/lib/features/question/presentation/bloc/question_bloc.dart index f02823f..c633716 100644 --- a/lib/features/question/presentation/bloc/question_bloc.dart +++ b/lib/features/question/presentation/bloc/question_bloc.dart @@ -48,6 +48,7 @@ class QuestionBloc extends Bloc { _backgroundAudioService.dispose(); answerAnimationController.dispose(); imageAnimationController.dispose(); + titleController.dispose(); return super.close(); } @@ -79,6 +80,7 @@ class QuestionBloc extends Bloc { final AudioService _effectAudioService; late final AnimationController answerAnimationController; late final AnimationController imageAnimationController; + final ScrollController titleController = ScrollController(); /// ------------Functions------------ void registerShowCase() { @@ -118,6 +120,15 @@ class QuestionBloc extends Bloc { } } + void startScrollTitle({Duration? audioDuration}) { + if (audioDuration == null || audioDuration == Duration.zero) return; + titleController.animateTo( + titleController.position.maxScrollExtent, + duration: audioDuration, + curve: Curves.linear + ); + } + void showHadith({required BuildContext context}) { showHadithDialog( context: context, @@ -165,7 +176,11 @@ class QuestionBloc extends Bloc { } Future playQuestionAudio() async { - await _mainAudioService.setAudio(filePath: state.currentQuestion?.audio); + if(titleController.hasClients){ + titleController.jumpTo(0); + } + Duration? duration = await _mainAudioService.setAudio(filePath: state.currentQuestion?.audio); + startScrollTitle(audioDuration: duration); await _mainAudioService.play(); } diff --git a/lib/features/question/presentation/ui/screens/question_screen.dart b/lib/features/question/presentation/ui/screens/question_screen.dart index 6736a4e..d0202bf 100644 --- a/lib/features/question/presentation/ui/screens/question_screen.dart +++ b/lib/features/question/presentation/ui/screens/question_screen.dart @@ -1,4 +1,3 @@ -import 'package:auto_size_text/auto_size_text.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:hadi_hoda_flutter/common_ui/resources/my_assets.dart'; @@ -135,17 +134,22 @@ class _QuestionScreenState extends State with TickerProviderStat previous.currentQuestion?.id != current.currentQuestion?.id, builder: (context, state) => FadeAnim( - child: AutoSizeText( - state.currentQuestion?.title ?? '', - textAlign: TextAlign.center, - maxLines: 4, - maxFontSize: 20, - minFontSize: 16, - style: MYTextStyle.titr1.copyWith( - shadows: [ - BoxShadow( - offset: Offset(0, 2), - color: MyColors.black.withValues(alpha: 0.25), + child: SizedBox( + height: 100, + child: ListView( + controller: context.read().titleController, + children: [ + Text( + state.currentQuestion?.title ?? '', + textAlign: TextAlign.center, + style: MYTextStyle.titr1.copyWith( + shadows: [ + BoxShadow( + offset: Offset(0, 2), + color: MyColors.black.withValues(alpha: 0.25), + ), + ], + ), ), ], ),