Browse Source

Merge pull request 'feature/battle_league' (#7) from feature/battle_league into develop

Reviewed-on: #7
pull/8/head
amirreza.chegini 4 weeks ago
parent
commit
4189e1865a
  1. 1
      lib/common_ui/resources/my_colors.dart
  2. 4
      lib/common_ui/theme/my_theme.dart
  3. 1
      lib/core/widgets/app_bar/my_app_bar.dart
  4. 38
      lib/features/battle_league/presentation/ui/battle_league_page.dart
  5. 4
      lib/features/home/presentation/controller/home_controller.dart
  6. 4
      lib/features/home/presentation/pages/home_page.dart
  7. 5
      lib/features/home/presentation/pages/widgets/home_battle_league.dart
  8. 9
      lib/features/master/presentation/ui/master_page.dart
  9. 6
      lib/init_bindings.dart
  10. 2
      lib/main.dart

1
lib/common_ui/resources/my_colors.dart

@ -9,4 +9,5 @@ class MyColors {
static const Color black = Colors.black; static const Color black = Colors.black;
static const Color transparent = Colors.transparent; static const Color transparent = Colors.transparent;
static const Color backgroundColor = Color(0xFF160C30); static const Color backgroundColor = Color(0xFF160C30);
static const Color battleLeagueBackgroundColor = Color(0XFF390C82);
} }

4
lib/common_ui/theme/my_theme.dart

@ -6,6 +6,7 @@ enum ColorsName {
primaryColor, primaryColor,
noColor, noColor,
backgroundColor, backgroundColor,
battleLeagueBackgroundColor,
} }
class MyTheme { class MyTheme {
@ -21,12 +22,14 @@ class MyTheme {
ColorsName.primaryColor: MyColors.white, ColorsName.primaryColor: MyColors.white,
ColorsName.noColor: MyColors.transparent, ColorsName.noColor: MyColors.transparent,
ColorsName.backgroundColor: MyColors.backgroundColor, ColorsName.backgroundColor: MyColors.backgroundColor,
ColorsName.battleLeagueBackgroundColor: MyColors.battleLeagueBackgroundColor,
}; };
static Map<ColorsName, Color> get darkColors => { static Map<ColorsName, Color> get darkColors => {
ColorsName.primaryColor: MyColors.white, ColorsName.primaryColor: MyColors.white,
ColorsName.noColor: MyColors.transparent, ColorsName.noColor: MyColors.transparent,
ColorsName.backgroundColor: MyColors.backgroundColor, ColorsName.backgroundColor: MyColors.backgroundColor,
ColorsName.battleLeagueBackgroundColor: MyColors.battleLeagueBackgroundColor,
}; };
} }
@ -37,4 +40,5 @@ extension ThemeExtension on BuildContext {
Color get primaryColor => customColors[ColorsName.primaryColor]!; Color get primaryColor => customColors[ColorsName.primaryColor]!;
Color get noColor => customColors[ColorsName.noColor]!; Color get noColor => customColors[ColorsName.noColor]!;
Color get backgroundColor => customColors[ColorsName.backgroundColor]!; Color get backgroundColor => customColors[ColorsName.backgroundColor]!;
Color get battleLeagueBackgroundColor => customColors[ColorsName.battleLeagueBackgroundColor]!;
} }

1
lib/core/widgets/app_bar/my_app_bar.dart

@ -36,6 +36,7 @@ class MyAppBar extends StatelessWidget implements PreferredSizeWidget {
backgroundColor: backgroundColor, backgroundColor: backgroundColor,
centerTitle: true, centerTitle: true,
titleSpacing: MySpaces.s30, titleSpacing: MySpaces.s30,
scrolledUnderElevation: 0,
title: AppBarType.title( title: AppBarType.title(
title: title, title: title,
diamondNumber: diamondNumber, diamondNumber: diamondNumber,

38
lib/features/battle_league/presentation/ui/battle_league_page.dart

@ -18,7 +18,7 @@ class BattleLeaguePage extends GetView<BattleLeagueController> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
backgroundColor: const Color(0XFF390C82),
backgroundColor: context.battleLeagueBackgroundColor,
appBar: MyAppBar( appBar: MyAppBar(
type: AppBarType.battleLeague, type: AppBarType.battleLeague,
backgroundColor: context.noColor, backgroundColor: context.noColor,
@ -30,7 +30,20 @@ class BattleLeaguePage extends GetView<BattleLeagueController> {
child: Column( child: Column(
children: [ children: [
MySpaces.s30.gapHeight, MySpaces.s30.gapHeight,
Padding(
_tabBars(context),
MySpaces.s12.gapHeight,
_tabViews(),
56.0.gapHeight,
_startButton(context),
MySpaces.s16.gapHeight,
],
),
),
);
}
Padding _tabBars(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: MySpaces.s30), padding: const EdgeInsets.symmetric(horizontal: MySpaces.s30),
child: BattleLeagueTabBar( child: BattleLeagueTabBar(
controller: controller.tabController, controller: controller.tabController,
@ -39,9 +52,11 @@ class BattleLeaguePage extends GetView<BattleLeagueController> {
context.translate.regional_ranking, context.translate.regional_ranking,
], ],
), ),
),
MySpaces.s12.gapHeight,
Expanded(
);
}
Expanded _tabViews() {
return Expanded(
child: TabBarView( child: TabBarView(
controller: controller.tabController, controller: controller.tabController,
children: const [ children: const [
@ -55,19 +70,16 @@ class BattleLeaguePage extends GetView<BattleLeagueController> {
), ),
], ],
), ),
),
56.0.gapHeight,
Padding(
);
}
Padding _startButton(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: MySpaces.s30), padding: const EdgeInsets.symmetric(horizontal: MySpaces.s30),
child: BattleLeagueStartButton( child: BattleLeagueStartButton(
title: context.translate.play_now, title: context.translate.play_now,
onTap: () {}, onTap: () {},
), ),
),
MySpaces.s16.gapHeight,
],
),
),
); );
} }
} }

4
lib/features/home/presentation/controller/home_controller.dart

@ -1,6 +1,7 @@
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:shia_game_flutter/core/params/home_params.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/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/entity/home_entity.dart';
import 'package:shia_game_flutter/features/home/domain/usecases/get_home_usecase.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<BaseStatus> getHomeStatus = Rx(const BaseInit()); final Rx<BaseStatus> getHomeStatus = Rx(const BaseInit());
/// ------ Functions ------ /// ------ Functions ------
void goToBattleLeaguePage() {
Get.toNamed(Routes.battleLeaguePage);
}
/// ------ Api Calls ------ /// ------ Api Calls ------
Future<void> getHome() async { Future<void> getHome() async {

4
lib/features/home/presentation/pages/home_page.dart

@ -25,7 +25,9 @@ class HomePage extends GetView<HomeController> {
const MyImage(asset: MyAssets.shiaMindGroup), const MyImage(asset: MyAssets.shiaMindGroup),
MySpaces.s40.gapHeight, MySpaces.s40.gapHeight,
const HomeMembership(), const HomeMembership(),
const HomeBattleLeague(),
HomeBattleLeague(
onTap: controller.goToBattleLeaguePage,
),
MySpaces.s20.gapHeight, MySpaces.s20.gapHeight,
_customWidgets(context), _customWidgets(context),
MySpaces.s20.gapHeight, MySpaces.s20.gapHeight,

5
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'; import 'package:shia_game_flutter/core/widgets/text/gradient_text.dart';
class HomeBattleLeague extends StatelessWidget { class HomeBattleLeague extends StatelessWidget {
const HomeBattleLeague({super.key});
const HomeBattleLeague({super.key, this.onTap});
final VoidCallback? onTap;
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
@ -18,6 +20,7 @@ class HomeBattleLeague extends StatelessWidget {
alignment: AlignmentDirectional.bottomEnd, alignment: AlignmentDirectional.bottomEnd,
children: [ children: [
MyContainer( MyContainer(
onTap: onTap,
width: context.widthScreen, width: context.widthScreen,
height: 120, height: 120,
padding: const EdgeInsets.symmetric( padding: const EdgeInsets.symmetric(

9
lib/features/master/presentation/ui/master_page.dart

@ -1,6 +1,8 @@
import 'package:flutter/material.dart'; 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/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/core/widgets/bottom_nav_bar/bottom_nav_bar.dart';
import 'package:shia_game_flutter/features/master/presentation/controller/master_controller.dart'; import 'package:shia_game_flutter/features/master/presentation/controller/master_controller.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
@ -12,7 +14,10 @@ class MasterPage extends GetView<MasterController> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
resizeToAvoidBottomInset: false, resizeToAvoidBottomInset: false,
appBar: const MasterAppBar(),
appBar: MyAppBar(
type: AppBarType.master,
backgroundColor: context.backgroundColor,
),
bottomNavigationBar: const BottomNavBar(), bottomNavigationBar: const BottomNavBar(),
body: GetRouterOutlet( body: GetRouterOutlet(
initialRoute: Routes.homePage, initialRoute: Routes.homePage,

6
lib/init_bindings.dart

@ -74,7 +74,7 @@ void initBindings() {
Get.lazyPut<GetProfileUseCase>(() => GetProfileUseCase(Get.find()), fenix: true); Get.lazyPut<GetProfileUseCase>(() => GetProfileUseCase(Get.find()), fenix: true);
/// ----- BattleLeague Feature ----- /// ----- BattleLeague Feature -----
Get.lazyPut<IBattleLeagueDatasource>(() => BattleLeagueDatasourceImpl(Get.find()));
Get.lazyPut<IBattleLeagueRepository>(() => BattleLeagueRepositoryImpl(Get.find()));
Get.lazyPut<GetBattleLeagueUseCase>(() => GetBattleLeagueUseCase(Get.find()));
Get.lazyPut<IBattleLeagueDatasource>(() => BattleLeagueDatasourceImpl(Get.find()), fenix: true);
Get.lazyPut<IBattleLeagueRepository>(() => BattleLeagueRepositoryImpl(Get.find()), fenix: true);
Get.lazyPut<GetBattleLeagueUseCase>(() => GetBattleLeagueUseCase(Get.find()), fenix: true);
} }

2
lib/main.dart

@ -31,7 +31,7 @@ class MainApp extends StatelessWidget {
fallbackLocale: const Locale('en', 'US'), fallbackLocale: const Locale('en', 'US'),
supportedLocales: const [Locale('en', 'US')], supportedLocales: const [Locale('en', 'US')],
getPages: appPages, getPages: appPages,
initialRoute: Routes.battleLeaguePage,
initialRoute: Routes.masterPage,
localizationsDelegates: const [ localizationsDelegates: const [
AppLocalizations.delegate, AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate, GlobalMaterialLocalizations.delegate,

Loading…
Cancel
Save