From f7a0d852f01e8c16ab8fd71118f1f41762646fd3 Mon Sep 17 00:00:00 2001 From: AmirrezaChegini Date: Fri, 24 Oct 2025 14:36:48 +0330 Subject: [PATCH 1/2] fix: battle league background color and widgets --- lib/common_ui/resources/my_colors.dart | 1 + lib/common_ui/theme/my_theme.dart | 4 + .../presentation/ui/battle_league_page.dart | 78 +++++++++++-------- 3 files changed, 50 insertions(+), 33 deletions(-) diff --git a/lib/common_ui/resources/my_colors.dart b/lib/common_ui/resources/my_colors.dart index 087ce37..05aae8d 100644 --- a/lib/common_ui/resources/my_colors.dart +++ b/lib/common_ui/resources/my_colors.dart @@ -9,4 +9,5 @@ class MyColors { static const Color black = Colors.black; static const Color transparent = Colors.transparent; static const Color backgroundColor = Color(0xFF160C30); + static const Color battleLeagueBackgroundColor = Color(0XFF390C82); } diff --git a/lib/common_ui/theme/my_theme.dart b/lib/common_ui/theme/my_theme.dart index 7ee5201..7b1a386 100644 --- a/lib/common_ui/theme/my_theme.dart +++ b/lib/common_ui/theme/my_theme.dart @@ -6,6 +6,7 @@ enum ColorsName { primaryColor, noColor, backgroundColor, + battleLeagueBackgroundColor, } class MyTheme { @@ -21,12 +22,14 @@ class MyTheme { ColorsName.primaryColor: MyColors.white, ColorsName.noColor: MyColors.transparent, ColorsName.backgroundColor: MyColors.backgroundColor, + ColorsName.battleLeagueBackgroundColor: MyColors.battleLeagueBackgroundColor, }; static Map get darkColors => { ColorsName.primaryColor: MyColors.white, ColorsName.noColor: MyColors.transparent, ColorsName.backgroundColor: MyColors.backgroundColor, + ColorsName.battleLeagueBackgroundColor: MyColors.battleLeagueBackgroundColor, }; } @@ -37,4 +40,5 @@ extension ThemeExtension on BuildContext { Color get primaryColor => customColors[ColorsName.primaryColor]!; Color get noColor => customColors[ColorsName.noColor]!; Color get backgroundColor => customColors[ColorsName.backgroundColor]!; + Color get battleLeagueBackgroundColor => customColors[ColorsName.battleLeagueBackgroundColor]!; } diff --git a/lib/features/battle_league/presentation/ui/battle_league_page.dart b/lib/features/battle_league/presentation/ui/battle_league_page.dart index 9d9954f..5d12617 100644 --- a/lib/features/battle_league/presentation/ui/battle_league_page.dart +++ b/lib/features/battle_league/presentation/ui/battle_league_page.dart @@ -18,7 +18,7 @@ class BattleLeaguePage extends GetView { @override Widget build(BuildContext context) { return Scaffold( - backgroundColor: const Color(0XFF390C82), + backgroundColor: context.battleLeagueBackgroundColor, appBar: MyAppBar( type: AppBarType.battleLeague, backgroundColor: context.noColor, @@ -30,44 +30,56 @@ class BattleLeaguePage extends GetView { child: Column( children: [ MySpaces.s30.gapHeight, - Padding( - padding: const EdgeInsets.symmetric(horizontal: MySpaces.s30), - child: BattleLeagueTabBar( - controller: controller.tabController, - tabs: [ - context.translate.time_ranking, - context.translate.regional_ranking, - ], - ), - ), + _tabBars(context), MySpaces.s12.gapHeight, - Expanded( - child: TabBarView( - controller: controller.tabController, - children: const [ - Padding( - padding: EdgeInsets.symmetric(horizontal: MySpaces.s30), - child: TimeRanking(), - ), - Padding( - padding: EdgeInsets.symmetric(horizontal: MySpaces.s30), - child: RegionalRanking(), - ), - ], - ), - ), + _tabViews(), 56.0.gapHeight, - Padding( - padding: const EdgeInsets.symmetric(horizontal: MySpaces.s30), - child: BattleLeagueStartButton( - title: context.translate.play_now, - onTap: () {}, - ), - ), + _startButton(context), MySpaces.s16.gapHeight, ], ), ), ); } + + Padding _tabBars(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: MySpaces.s30), + child: BattleLeagueTabBar( + controller: controller.tabController, + tabs: [ + context.translate.time_ranking, + context.translate.regional_ranking, + ], + ), + ); + } + + Expanded _tabViews() { + return Expanded( + child: TabBarView( + controller: controller.tabController, + children: const [ + Padding( + padding: EdgeInsets.symmetric(horizontal: MySpaces.s30), + child: TimeRanking(), + ), + Padding( + padding: EdgeInsets.symmetric(horizontal: MySpaces.s30), + child: RegionalRanking(), + ), + ], + ), + ); + } + + Padding _startButton(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(horizontal: MySpaces.s30), + child: BattleLeagueStartButton( + title: context.translate.play_now, + onTap: () {}, + ), + ); + } } -- 2.30.2 From a9e00629de7d58de8f763cf4181a6002ea3aa124 Mon Sep 17 00:00:00 2001 From: AmirrezaChegini Date: Fri, 24 Oct 2025 14:45:33 +0330 Subject: [PATCH 2/2] fix: master app bar & routing battle league page --- lib/core/widgets/app_bar/my_app_bar.dart | 1 + .../home/presentation/controller/home_controller.dart | 4 ++++ lib/features/home/presentation/pages/home_page.dart | 4 +++- .../presentation/pages/widgets/home_battle_league.dart | 5 ++++- lib/features/master/presentation/ui/master_page.dart | 9 +++++++-- lib/init_bindings.dart | 6 +++--- lib/main.dart | 2 +- 7 files changed, 23 insertions(+), 8 deletions(-) diff --git a/lib/core/widgets/app_bar/my_app_bar.dart b/lib/core/widgets/app_bar/my_app_bar.dart index e4760de..784fa36 100644 --- a/lib/core/widgets/app_bar/my_app_bar.dart +++ b/lib/core/widgets/app_bar/my_app_bar.dart @@ -36,6 +36,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget { backgroundColor: backgroundColor, centerTitle: true, titleSpacing: MySpaces.s30, + scrolledUnderElevation: 0, title: AppBarType.title( title: title, diamondNumber: diamondNumber, diff --git a/lib/features/home/presentation/controller/home_controller.dart b/lib/features/home/presentation/controller/home_controller.dart index ce21b15..f221868 100644 --- a/lib/features/home/presentation/controller/home_controller.dart +++ b/lib/features/home/presentation/controller/home_controller.dart @@ -1,6 +1,7 @@ import 'package:flutter/cupertino.dart'; import 'package:get/get.dart'; import 'package:shia_game_flutter/core/params/home_params.dart'; +import 'package:shia_game_flutter/core/routers/my_routes.dart'; import 'package:shia_game_flutter/core/status/base_status.dart'; import 'package:shia_game_flutter/features/home/domain/entity/home_entity.dart'; import 'package:shia_game_flutter/features/home/domain/usecases/get_home_usecase.dart'; @@ -35,6 +36,9 @@ class HomeController extends GetxController with StateMixin { final Rx getHomeStatus = Rx(const BaseInit()); /// ------ Functions ------ + void goToBattleLeaguePage() { + Get.toNamed(Routes.battleLeaguePage); + } /// ------ Api Calls ------ Future getHome() async { diff --git a/lib/features/home/presentation/pages/home_page.dart b/lib/features/home/presentation/pages/home_page.dart index b7af715..f359ea2 100644 --- a/lib/features/home/presentation/pages/home_page.dart +++ b/lib/features/home/presentation/pages/home_page.dart @@ -25,7 +25,9 @@ class HomePage extends GetView { const MyImage(asset: MyAssets.shiaMindGroup), MySpaces.s40.gapHeight, const HomeMembership(), - const HomeBattleLeague(), + HomeBattleLeague( + onTap: controller.goToBattleLeaguePage, + ), MySpaces.s20.gapHeight, _customWidgets(context), MySpaces.s20.gapHeight, diff --git a/lib/features/home/presentation/pages/widgets/home_battle_league.dart b/lib/features/home/presentation/pages/widgets/home_battle_league.dart index 76093b1..8942659 100644 --- a/lib/features/home/presentation/pages/widgets/home_battle_league.dart +++ b/lib/features/home/presentation/pages/widgets/home_battle_league.dart @@ -10,7 +10,9 @@ import 'package:shia_game_flutter/core/widgets/image/my_image.dart'; import 'package:shia_game_flutter/core/widgets/text/gradient_text.dart'; class HomeBattleLeague extends StatelessWidget { - const HomeBattleLeague({super.key}); + const HomeBattleLeague({super.key, this.onTap}); + + final VoidCallback? onTap; @override Widget build(BuildContext context) { @@ -18,6 +20,7 @@ class HomeBattleLeague extends StatelessWidget { alignment: AlignmentDirectional.bottomEnd, children: [ MyContainer( + onTap: onTap, width: context.widthScreen, height: 120, padding: const EdgeInsets.symmetric( diff --git a/lib/features/master/presentation/ui/master_page.dart b/lib/features/master/presentation/ui/master_page.dart index 79786e2..1795fec 100644 --- a/lib/features/master/presentation/ui/master_page.dart +++ b/lib/features/master/presentation/ui/master_page.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; +import 'package:shia_game_flutter/common_ui/theme/my_theme.dart'; import 'package:shia_game_flutter/core/routers/my_routes.dart'; -import 'package:shia_game_flutter/core/widgets/app_bar/styles/master_app_bar.dart'; +import 'package:shia_game_flutter/core/widgets/app_bar/enums/app_bar_type.dart'; +import 'package:shia_game_flutter/core/widgets/app_bar/my_app_bar.dart'; import 'package:shia_game_flutter/core/widgets/bottom_nav_bar/bottom_nav_bar.dart'; import 'package:shia_game_flutter/features/master/presentation/controller/master_controller.dart'; import 'package:get/get.dart'; @@ -12,7 +14,10 @@ class MasterPage extends GetView { Widget build(BuildContext context) { return Scaffold( resizeToAvoidBottomInset: false, - appBar: const MasterAppBar(), + appBar: MyAppBar( + type: AppBarType.master, + backgroundColor: context.backgroundColor, + ), bottomNavigationBar: const BottomNavBar(), body: GetRouterOutlet( initialRoute: Routes.homePage, diff --git a/lib/init_bindings.dart b/lib/init_bindings.dart index 213f6b3..fc3a664 100644 --- a/lib/init_bindings.dart +++ b/lib/init_bindings.dart @@ -74,7 +74,7 @@ void initBindings() { Get.lazyPut(() => GetProfileUseCase(Get.find()), fenix: true); /// ----- BattleLeague Feature ----- - Get.lazyPut(() => BattleLeagueDatasourceImpl(Get.find())); - Get.lazyPut(() => BattleLeagueRepositoryImpl(Get.find())); - Get.lazyPut(() => GetBattleLeagueUseCase(Get.find())); + Get.lazyPut(() => BattleLeagueDatasourceImpl(Get.find()), fenix: true); + Get.lazyPut(() => BattleLeagueRepositoryImpl(Get.find()), fenix: true); + Get.lazyPut(() => GetBattleLeagueUseCase(Get.find()), fenix: true); } diff --git a/lib/main.dart b/lib/main.dart index 2939bb2..98bea17 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -31,7 +31,7 @@ class MainApp extends StatelessWidget { fallbackLocale: const Locale('en', 'US'), supportedLocales: const [Locale('en', 'US')], getPages: appPages, - initialRoute: Routes.battleLeaguePage, + initialRoute: Routes.masterPage, localizationsDelegates: const [ AppLocalizations.delegate, GlobalMaterialLocalizations.delegate, -- 2.30.2