From ddd44491ee477b0d4875af3d1a8b227b47d6fd1b Mon Sep 17 00:00:00 2001 From: AmirrezaChegini Date: Thu, 9 Oct 2025 17:49:30 +0330 Subject: [PATCH] fix: some position and bloc rebuilt --- lib/features/level/presentation/bloc/level_bloc.dart | 4 ++-- lib/features/level/presentation/ui/level_page.dart | 6 ++---- lib/features/question/presentation/ui/question_page.dart | 4 ++++ .../question/presentation/ui/screens/question_screen.dart | 8 ++++++++ 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/lib/features/level/presentation/bloc/level_bloc.dart b/lib/features/level/presentation/bloc/level_bloc.dart index 23b2d8c..ef5cde4 100644 --- a/lib/features/level/presentation/bloc/level_bloc.dart +++ b/lib/features/level/presentation/bloc/level_bloc.dart @@ -42,9 +42,9 @@ class LevelBloc extends Bloc { LevelLocation(bottom: -30, left: 30, index: 1), LevelLocation(bottom: 50, left: 100, index: 2), LevelLocation(bottom: 150, left: 60, index: 3), - LevelLocation(bottom: 210, left: 120, index: 4), + LevelLocation(bottom: 210, left: 110, index: 4), LevelLocation(bottom: 250, right: 60, index: 5), - LevelLocation(top: 150, right: 40, index: 6), + LevelLocation(top: 170, right: 40, index: 6), LevelLocation(top: 70, right: 70, index: 7), LevelLocation(top: -20, right: 70, index: 8), ]; diff --git a/lib/features/level/presentation/ui/level_page.dart b/lib/features/level/presentation/ui/level_page.dart index 08d8fff..c9b774e 100644 --- a/lib/features/level/presentation/ui/level_page.dart +++ b/lib/features/level/presentation/ui/level_page.dart @@ -45,9 +45,7 @@ class LevelPage extends StatelessWidget { builder: (context, state) { if (state.chooseLevel?.id != null) { return Positioned( - bottom: MediaQuery - .viewPaddingOf(context) - .bottom + MySpaces.s10, + bottom: MediaQuery.viewPaddingOf(context).bottom + MySpaces.s10, right: MySpaces.s16, left: MySpaces.s16, child: HintLevelWidget( @@ -137,7 +135,7 @@ class LevelPage extends StatelessWidget { children: [ BottomPath( width: context.widthScreen * 0.75, - height: context.heightScreen * 0.6, + height: context.heightScreen * 0.65, ), ...List.generate( context.read().bottom8LevelList.length, diff --git a/lib/features/question/presentation/ui/question_page.dart b/lib/features/question/presentation/ui/question_page.dart index 70efad9..746c25c 100644 --- a/lib/features/question/presentation/ui/question_page.dart +++ b/lib/features/question/presentation/ui/question_page.dart @@ -92,6 +92,8 @@ class QuestionPage extends StatelessWidget { ), Spacer(), BlocBuilder( + buildWhen: (previous, current) => + previous.levelEntity?.id != current.levelEntity?.id, builder: (context, state) => Text( '${context.translate.step} ${state.levelEntity?.order ?? 1}', style: Marhey.bold14.copyWith( @@ -119,6 +121,8 @@ class QuestionPage extends StatelessWidget { Widget _stepper() { return BlocBuilder( + buildWhen: (previous, current) => + previous.currentQuestion?.id != current.currentQuestion?.id, builder: (context, state) => QuestionStepper( length: state.levelEntity?.questions?.length ?? 0, currentStep: state.currentQuestion?.order ?? 1, diff --git a/lib/features/question/presentation/ui/screens/question_screen.dart b/lib/features/question/presentation/ui/screens/question_screen.dart index dc069aa..c4ec545 100644 --- a/lib/features/question/presentation/ui/screens/question_screen.dart +++ b/lib/features/question/presentation/ui/screens/question_screen.dart @@ -37,6 +37,8 @@ class QuestionScreen extends StatelessWidget { spacing: MySpaces.s4, children: [ BlocBuilder( + buildWhen: (previous, current) => + previous.currentQuestion?.id != current.currentQuestion?.id, builder: (context, state) => Text( '${context.translate.question} ${state.currentQuestion?.order ?? 1} / ${(state.levelEntity?.questions?.length ?? 0) - 1}', style: Marhey.medium12.copyWith( @@ -52,6 +54,8 @@ class QuestionScreen extends StatelessWidget { ), ), BlocBuilder( + buildWhen: (previous, current) => + previous.currentQuestion?.id != current.currentQuestion?.id, builder: (context, state) => Text( state.currentQuestion?.title ?? '', textAlign: TextAlign.center, @@ -84,6 +88,8 @@ class QuestionScreen extends StatelessWidget { globalKey: context.read().keys[index], description: context.translate.tap_to_select, child: BlocBuilder( + buildWhen: (previous, current) => + previous.currentQuestion?.id != current.currentQuestion?.id, builder: (context, state) => AnswerBox( key: Key('${state.currentQuestion?.id}'), index: state.currentQuestion?.answers?[index].order ?? 1, @@ -105,6 +111,8 @@ class QuestionScreen extends StatelessWidget { children: [ Spacer(), BlocBuilder( + buildWhen: (previous, current) => + previous.correctAnswer != current.correctAnswer, builder: (context, state) => Stack( clipBehavior: Clip.none, children: [