Browse Source

fix and update

develop
sina 2 days ago
parent
commit
0449ea4379
  1. 3
      lib/core/widgets/dialog/hadith_dialog.dart
  2. 2
      lib/features/level/presentation/ui/level_page.dart
  3. 18
      lib/features/question/presentation/bloc/question_bloc.dart
  4. 2
      lib/features/question/presentation/ui/screens/question_screen.dart
  5. 2
      lib/l10n/app_localizations_id.dart

3
lib/core/widgets/dialog/hadith_dialog.dart

@ -67,13 +67,12 @@ class HadithDialog extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text.rich(
textDirection: TextDirection.rtl,
TextSpan(
text:
'${hadith[index].narratorName ?? ''}:\n',
style: MYTextStyle.titr1.copyWith(
color: const Color(0XFF494178),
height: isArabic ? 1.8 : 1,
height: isArabic ? 1.8 : 1.05,
fontFamily: MYTextStyle.notoSansArabic,
),
children: [

2
lib/features/level/presentation/ui/level_page.dart

@ -259,7 +259,7 @@ class _LevelPageState extends State<LevelPage> {
top: 0,
right: 0,
left: 0,
bottom: (comingSoon.bottom ?? 0) + 120,
bottom: (comingSoon.bottom ?? 0) + 174,
child: _lockMapShadowCover(),
),
Positioned(

18
lib/features/question/presentation/bloc/question_bloc.dart

@ -50,6 +50,7 @@ class QuestionBloc extends Bloc<QuestionEvent, QuestionState> {
imageAnimationController?.dispose();
globeAnimationController?.dispose();
scrollController.dispose();
questionsScrollController.dispose();
PaintingBinding.instance.imageCache.clear();
PaintingBinding.instance.imageCache.clearLiveImages();
return super.close();
@ -100,6 +101,7 @@ class QuestionBloc extends Bloc<QuestionEvent, QuestionState> {
AnimationController? imageAnimationController;
AnimationController? globeAnimationController;
final ScrollController scrollController = ScrollController();
final ScrollController questionsScrollController = ScrollController();
int _nextSequenceToken() => ++_sequenceToken;
@ -193,8 +195,20 @@ class QuestionBloc extends Bloc<QuestionEvent, QuestionState> {
if (answers.isNotEmpty) {
answers.removeWhere((e) => e.imageId == null);
}
for (final answer in answers) {
for (int i = 0;i < answers.length; i++) {
if (!_isActiveSequence(token)) return;
final answer = answers[i];
// scroll to bottom to see answers better
final currentPixelsPosition = questionsScrollController.position.pixels;
final maxScrollExtent = questionsScrollController.position.maxScrollExtent;
if(i > 1 && currentPixelsPosition <
maxScrollExtent) {
questionsScrollController.animateTo(
maxScrollExtent,
duration: const Duration(milliseconds: 300),
curve: Curves.easeOut,
);
}
await Future.delayed(const Duration(milliseconds: 350), () async {
if (_isActiveSequence(token) && MyContext.get.mounted) {
await showAnswerDialog(
@ -347,6 +361,7 @@ class QuestionBloc extends Bloc<QuestionEvent, QuestionState> {
await Future.delayed(const Duration(milliseconds: 30));
if (!_isActiveSequence(token)) return;
scrollController.jumpTo(0);
questionsScrollController.jumpTo(0);
answerAnimationController?.reverse();
await Future.delayed(const Duration(seconds: 1), () async {
if (!_isActiveSequence(token)) return;
@ -383,6 +398,7 @@ class QuestionBloc extends Bloc<QuestionEvent, QuestionState> {
if (!_isActiveSequence(token)) return;
imageAnimationController?.forward();
scrollController.jumpTo(0);
questionsScrollController.jumpTo(0);
changeGlobeState(key: MyAnimations.globeStateSpeaking);
await playQuestionAudio();
if (!_isActiveSequence(token)) return;

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

@ -172,7 +172,7 @@ class _QuestionScreenState extends State<QuestionScreen>
child: child,
),
child: ListView(
controller: context.read<QuestionBloc>().scrollController,
controller: context.read<QuestionBloc>().questionsScrollController,
padding: const EdgeInsets.only(top: 10),
children: [
FadeAnimController(

2
lib/l10n/app_localizations_id.dart

@ -103,7 +103,7 @@ class AppLocalizationsId extends AppLocalizations {
String get exit => 'Keluar';
@override
String get play => 'MAIN';
String get play => 'Bermain ';
@override
String get no_hadith => 'Tidak ada Hadith untuk pertanyaan ini';

Loading…
Cancel
Save