Browse Source

Merge pull request 'fix/battle_league' (#14) from fix/battle_league into develop

Reviewed-on: #14
develop
amirreza.chegini 6 days ago
parent
commit
8a64d0174b
  1. BIN
      assets/images/electro.png
  2. BIN
      assets/images/union.png
  3. BIN
      assets/images/vs.png
  4. 33
      assets/svg/icon_iran.svg
  5. 4
      lib/common_ui/resources/my_assets.dart
  6. 27
      lib/core/routers/my_routes.dart
  7. 61
      lib/core/widgets/loading/my_linear_loading.dart
  8. 9
      lib/features/battle_league/presentation/controller/battle_league_controller.dart
  9. 140
      lib/features/battle_league/presentation/ui/battle_find_page.dart
  10. 80
      lib/features/battle_league/presentation/ui/battle_league_finding_page.dart
  11. 59
      lib/features/battle_league/presentation/ui/battle_league_founded_page.dart
  12. 10
      lib/features/battle_league/presentation/ui/battle_league_page.dart
  13. 17
      lib/features/battle_league/presentation/ui/battle_league_topic_page.dart
  14. 4
      lib/features/battle_league/presentation/ui/widgets/button/battle_golden_button.dart
  15. 0
      lib/features/battle_league/presentation/ui/widgets/button/battle_grey_button.dart
  16. 42
      lib/features/battle_league/presentation/ui/widgets/button/battle_purple_button.dart
  17. 63
      lib/features/battle_league/presentation/ui/widgets/founded_page/founded_avatar.dart
  18. 0
      lib/features/battle_league/presentation/ui/widgets/main_page/battle_league_tab_bar.dart
  19. 0
      lib/features/battle_league/presentation/ui/widgets/main_page/filter_ranking_button.dart
  20. 0
      lib/features/battle_league/presentation/ui/widgets/main_page/my_ranking_widget.dart
  21. 0
      lib/features/battle_league/presentation/ui/widgets/main_page/ranking_region.dart
  22. 0
      lib/features/battle_league/presentation/ui/widgets/main_page/ranking_scrollbar.dart
  23. 0
      lib/features/battle_league/presentation/ui/widgets/main_page/ranking_time.dart
  24. 0
      lib/features/battle_league/presentation/ui/widgets/main_page/ranking_widget.dart
  25. 10
      lib/features/battle_league/presentation/ui/widgets/main_page/regional_ranking.dart
  26. 10
      lib/features/battle_league/presentation/ui/widgets/main_page/time_ranking.dart
  27. 44
      lib/features/battle_league/presentation/ui/widgets/rank_title.dart
  28. 0
      lib/features/battle_league/presentation/ui/widgets/topic_page/topic_widget.dart
  29. 16
      lib/features/intro/presentation/ui/intro_page.dart
  30. 48
      lib/features/intro/presentation/ui/widgets/intro_loading.dart
  31. 28
      lib/features/topic/data/datasource/topic_datasource.dart
  32. 13
      lib/features/topic/data/model/topic_model.dart
  33. 29
      lib/features/topic/data/repository_impl/topic_repository_impl.dart
  34. 14
      lib/features/topic/domain/entity/topic_entity.dart
  35. 8
      lib/features/topic/domain/repository/topic_repository.dart
  36. 19
      lib/features/topic/domain/usecases/get_topic_usecase.dart
  37. 20
      lib/features/topic/presentation/binding/topic_binding.dart
  38. 54
      lib/features/topic/presentation/controller/topic_controller.dart
  39. 9
      lib/init_bindings.dart

BIN
assets/images/electro.png

After

Width: 750  |  Height: 905  |  Size: 52 KiB

BIN
assets/images/union.png

After

Width: 375  |  Height: 812  |  Size: 241 KiB

BIN
assets/images/vs.png

After

Width: 64  |  Height: 66  |  Size: 6.5 KiB

33
assets/svg/icon_iran.svg

@ -0,0 +1,33 @@
<svg width="21" height="21" viewBox="0 0 21 21" fill="none" xmlns="http://www.w3.org/2000/svg">
<g clip-path="url(#clip0_150_1141)">
<path d="M10.5008 0.656311C6.20234 0.656311 2.56016 3.37975 1.21484 7.21881H19.7867C18.4414 3.37975 14.7992 0.656311 10.5008 0.656311Z" fill="#83BF4F"/>
<path d="M10.5008 20.3438C14.7992 20.3438 18.4414 17.6204 19.7867 13.7813H1.21484C2.56016 17.6204 6.20234 20.3438 10.5008 20.3438Z" fill="#ED4C5C"/>
<path d="M1.21406 7.21881C0.853125 8.236 0.65625 9.35162 0.65625 10.5001C0.65625 11.6485 0.853125 12.7641 1.21406 13.7813H19.7859C20.1469 12.7641 20.3438 11.6485 20.3438 10.5001C20.3438 9.35162 20.1469 8.236 19.7859 7.21881H1.21406Z" fill="#F9F9F9"/>
<path d="M19.491 14.5359L19.3926 14.7328H19.491V14.5359ZM1.6082 14.7328L1.50977 14.5359V14.7328H1.6082ZM1.83789 6.16876H1.67383C1.64102 6.20157 1.6082 6.23439 1.6082 6.2672H1.83789V6.16876Z" fill="white"/>
<path d="M1.83916 6.89012V6.79169H1.51104V6.59481H2.00322V6.89012H2.7251V6.13544H2.62666V6.75887H2.42979V6.13544H2.33135V6.75887H2.13447V6.13544H2.03604V6.46356H1.51104C1.47822 6.52919 1.44541 6.62762 1.4126 6.69325V6.89012H1.83916ZM1.83916 14.7323H1.60947C1.60947 14.7651 1.64229 14.7979 1.6751 14.8307H1.87197L1.83916 14.7323ZM1.51104 14.5354H2.00322V14.8307H2.7251V14.0761H2.62666V14.6995H2.42979V14.0761H2.33135V14.6995H2.13447V14.0761H2.03604V14.4042H1.47822C1.47822 14.4698 1.51104 14.5026 1.51104 14.5354Z" fill="white"/>
<path d="M1.83789 14.1088H1.3457C1.3457 14.1416 1.37852 14.1744 1.37852 14.2072H1.83789V14.1088ZM4.46289 6.89006H4.92227V6.79163H4.59414V6.59475H5.08633V6.89006H5.8082V6.13538H5.70977V6.79163H5.51289V6.13538H5.38164V6.79163H5.18477V6.13538H5.08633V6.4635H4.46289V6.89006ZM4.26602 6.89006V6.4635H3.83945V6.59475H4.16758V6.79163H3.67539V6.4635H2.95352V6.92288H3.05195V6.59475H3.54414V6.89006H4.26602Z" fill="white"/>
<path d="M3.21523 6.7922H3.3793V6.89064H3.21523V6.7922ZM2.91992 6.16876H4.92148V6.2672H2.91992V6.16876ZM3.83867 14.5359H4.1668V14.7328H3.67461V14.4047H2.95273V14.8641H3.05117V14.5359H3.54336V14.8313H4.26523V14.4047H3.83867V14.5359Z" fill="white"/>
<path d="M3.21523 14.7326H3.3793V14.831H3.21523V14.7326ZM2.91992 14.1091H4.92148V14.2076H2.91992V14.1091Z" fill="white"/>
<path d="M5.70977 14.7323H5.51289V14.0761H5.38164V14.7323H5.18477V14.0761H5.08633V14.4042H4.46289V14.8307H4.92227V14.7323H4.59414V14.5354H5.08633V14.8307H5.8082V14.0761H5.70977V14.7323ZM7.54727 6.89012H7.97383V6.79169H7.6457V6.59481H8.13789V6.89012H8.85977V6.13544H8.76133V6.79169H8.56445V6.13544H8.46602V6.79169H8.26914V6.13544H8.13789V6.46356H7.54727V6.89012ZM7.35039 6.89012V6.46356H6.89102V6.59481H7.21914V6.79169H6.72695V6.46356H6.00508V6.92294H6.10352V6.59481H6.62852V6.89012H7.35039Z" fill="white"/>
<path d="M5.97314 6.16876H7.97471V6.2672H5.97314V6.16876ZM6.30127 6.7922H6.46533V6.89064H6.30127V6.7922ZM8.76221 14.7328H8.56533V14.0766H8.46689V14.7328H8.27002V14.0766H8.13877V14.4047H7.54814V14.8313H7.97471V14.7328H7.64658V14.5359H8.13877V14.8313H8.86064V14.0766H8.76221V14.7328ZM6.30127 14.7328H6.46533V14.8313H6.30127V14.7328Z" fill="white"/>
<path d="M5.97314 14.1094H7.97471V14.2078H5.97314V14.1094ZM6.89189 14.5359H7.22002V14.7328H6.72783V14.4047H6.00596V14.8641H6.10439V14.5359H6.62939V14.8313H7.35127V14.4047H6.89189V14.5359ZM10.4028 6.89064V6.46408H9.97627V6.59533H10.3044V6.7922H9.77939V6.46408H9.05752V6.92345H9.18877V6.59533H9.68096V6.89064H10.4028ZM9.05752 6.16876H11.0591V6.2672H9.05752V6.16876Z" fill="white"/>
<path d="M9.35195 6.79169H9.51602V6.89012H9.35195V6.79169ZM10.5988 6.89012H11.0254V6.79169H10.6973V6.59481H11.2223V6.89012H11.9441V6.13544H11.8129V6.79169H11.616V6.13544H11.5176V6.79169H11.3207V6.13544H11.2223V6.46356H10.5988V6.89012ZM9.05664 14.1089H11.0582V14.2073H9.05664V14.1089ZM9.97539 14.5354H10.3035V14.7323H9.77852V14.4042H9.05664V14.8636H9.18789V14.5354H9.68008V14.8307H10.402V14.4042H9.97539V14.5354Z" fill="white"/>
<path d="M9.35156 14.7328H9.51562V14.8313H9.35156V14.7328ZM11.8125 14.7328H11.6156V14.0766H11.5172V14.7328H11.3203V14.0766H11.2219V14.4047H10.5984V14.8313H11.025V14.7328H10.6969V14.5359H11.2219V14.8313H11.9438V14.0766H11.8125V14.7328ZM12.4031 6.7922H12.5672V6.89064H12.4031V6.7922ZM12.1078 6.16876H14.1094V6.2672H12.1078V6.16876Z" fill="white"/>
<path d="M13.6496 6.89012H14.109V6.79169H13.7809V6.59481H14.273V6.89012H14.9949V6.13544H14.8965V6.79169H14.6996V6.13544H14.5684V6.79169H14.3715V6.13544H14.273V6.46356H13.6496V6.89012ZM13.4527 6.89012V6.46356H13.0262V6.59481H13.3543V6.79169H12.8621V6.46356H12.1402V6.92294H12.2387V6.59481H12.7309V6.89012H13.4527ZM12.1074 14.1089H14.109V14.2073H12.1074V14.1089Z" fill="white"/>
<path d="M14.8969 14.7321H14.7V14.0758H14.5688V14.7321H14.3719V14.0758H14.2734V14.4039H13.65V14.8305H14.1094V14.7321H13.7812V14.5352H14.2734V14.8305H14.9953V14.0758H14.8969V14.7321ZM13.0266 14.5352H13.3547V14.7321H12.8625V14.4039H12.1406V14.8633H12.2391V14.5352H12.7312V14.8305H13.4531V14.4039H13.0266V14.5352Z" fill="white"/>
<path d="M12.4048 14.7323H12.5688V14.8307H12.4048V14.7323ZM16.5392 6.89012V6.46356H16.0798V6.59481H16.4079V6.79169H15.9157V6.46356H15.1938V6.92294H15.2923V6.59481H15.8173V6.89012H16.5392Z" fill="white"/>
<path d="M15.4888 6.7922H15.6528V6.89064H15.4888V6.7922ZM15.1606 6.16876H17.1622V6.2672H15.1606V6.16876Z" fill="white"/>
<path d="M16.7356 6.89012H17.1622V6.79169H16.8341V6.59481H17.3263V6.89012H18.0481V6.13544H17.9497V6.79169H17.7528V6.13544H17.6544V6.79169H17.4575V6.13544H17.3263V6.46356H16.7356V6.89012ZM15.4888 14.7323H15.6528V14.8307H15.4888V14.7323Z" fill="white"/>
<path d="M16.0794 14.5357H16.4075V14.7326H15.9153V14.4044H15.1935V14.8638H15.2919V14.5357H15.8169V14.831H16.5388V14.4044H16.0794V14.5357ZM15.1606 14.1091H17.1622V14.2076H15.1606V14.1091Z" fill="white"/>
<path d="M17.9484 14.7328H17.7516V14.0766H17.6531V14.7328H17.4563V14.0766H17.325V14.4047H16.7344V14.8313H17.1609V14.7328H16.8328V14.5359H17.325V14.8313H18.0469V14.0766H17.9484V14.7328ZM18.2437 6.2672H19.3922C19.3594 6.23439 19.3594 6.20157 19.3266 6.16876H18.2109C18.2437 6.16876 18.2437 6.2672 18.2437 6.2672ZM19.1625 6.59533H19.4906V6.7922H18.9984V6.49689H18.2766V6.92345H18.375V6.59533H18.8672V6.89064H19.5891V6.72657C19.5563 6.66095 19.5234 6.56251 19.4906 6.49689H19.1625V6.59533Z" fill="white"/>
<path d="M18.5395 6.79169H18.7035V6.89012H18.5395V6.79169ZM18.5395 14.7323H18.7035V14.8307H18.5395V14.7323ZM18.2441 14.1089V14.2073H19.6223C19.6223 14.1745 19.6551 14.1417 19.6551 14.1089H18.2441ZM19.1629 14.5354H19.491C19.5238 14.5026 19.5238 14.4698 19.5566 14.4042H19.1629V14.5354Z" fill="white"/>
<path d="M18.966 14.7326V14.4373H18.2441V14.8638H18.3754V14.5357H18.8676V14.831H19.327C19.3598 14.7982 19.3598 14.7654 19.3926 14.7326H18.966Z" fill="white"/>
<path d="M11.9758 11.1232C12.2711 10.2701 11.9758 9.31855 11.3195 8.72793C12.0742 9.84355 11.7789 11.3201 10.7289 12.1076L10.7945 10.2701V8.82637C10.6633 8.76074 10.5648 8.69512 10.4992 8.59668C10.4336 8.69512 10.3351 8.79355 10.2039 8.82637V10.2701L10.2695 12.1076C9.18671 11.3201 8.92421 9.84355 9.67889 8.72793C8.98983 9.31855 8.72733 10.2701 9.02264 11.1232C9.21952 11.7139 9.61327 12.1404 10.1055 12.4029C9.81014 12.5014 9.48202 12.567 9.15389 12.567C9.54764 12.6982 9.94139 12.6982 10.3023 12.6326V12.6982L10.4992 12.9607L10.6961 12.6982V12.6326C11.057 12.6982 11.4508 12.6982 11.8445 12.567C11.5164 12.567 11.1883 12.5342 10.893 12.4029C11.3851 12.1404 11.7789 11.6811 11.9758 11.1232Z" fill="#ED4C5C"/>
<path d="M12.6975 9.54824C12.435 9.12168 12.0084 8.79355 11.5162 8.6623C12.599 9.48262 12.8287 11.0248 12.0084 12.1076C12.9272 11.6154 13.2225 10.467 12.6975 9.54824ZM9.44904 8.6623C8.95686 8.79355 8.53029 9.08887 8.26779 9.54824C7.74279 10.4342 8.07092 11.5826 8.95686 12.1076C8.16936 11.0248 8.36623 9.48262 9.44904 8.6623ZM10.0069 8.53105C10.1709 8.62949 10.4006 8.59668 10.499 8.43262C10.5975 8.59668 10.8272 8.62949 10.9912 8.53105C11.1225 8.43262 11.1881 8.26855 11.1225 8.10449C11.0897 8.30137 10.9256 8.3998 10.7287 8.36699C10.6303 8.33418 10.5647 8.30137 10.499 8.20293C10.4662 8.30137 10.3678 8.33418 10.2694 8.36699C10.0725 8.3998 9.90842 8.26855 9.87561 8.10449C9.80998 8.26855 9.87561 8.43262 10.0069 8.53105Z" fill="#ED4C5C"/>
</g>
<defs>
<clipPath id="clip0_150_1141">
<rect width="21" height="21" fill="white"/>
</clipPath>
</defs>
</svg>

4
lib/common_ui/resources/my_assets.dart

@ -31,6 +31,9 @@ class MyAssets {
static const String member4 = 'assets/images/member_4.png';
static const String done = 'assets/images/done.png';
static const String worldMap = 'assets/images/world_map.png';
static const String union = 'assets/images/union.png';
static const String vs = 'assets/images/vs.png';
static const String electro = 'assets/images/electro.png';
/// ----- Svg -----
static const String iconHome = 'assets/svg/icon_home.svg';
@ -66,6 +69,7 @@ class MyAssets {
static const String iconArt = 'assets/svg/icon_art.svg';
static const String iconRandom = 'assets/svg/icon_random.svg';
static const String magnifier = 'assets/svg/magnifier.svg';
static const String iconIran = 'assets/svg/icon_iran.svg';
/// ----- Audios -----
static const String sampleAudio = 'assets/audios/sample.mp3';

27
lib/core/routers/my_routes.dart

@ -1,5 +1,7 @@
import 'package:shia_game_flutter/features/awards/presentation/binding/awards_binding.dart';
import 'package:shia_game_flutter/features/awards/presentation/ui/awards_page.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/battle_league_finding_page.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/battle_league_founded_page.dart';
import 'package:shia_game_flutter/features/home/presentation/binding/home_binding.dart';
import 'package:shia_game_flutter/features/home/presentation/pages/home_page.dart';
import 'package:shia_game_flutter/features/intro/presentation/binding/intro_binding.dart';
@ -15,8 +17,7 @@ import 'package:shia_game_flutter/features/battle_league/presentation/ui/battle_
import 'package:get/get.dart';
import 'package:shia_game_flutter/features/shop/presentation/binding/shop_binding.dart';
import 'package:shia_game_flutter/features/shop/presentation/ui/shop_page.dart';
import 'package:shia_game_flutter/features/topic/presentation/binding/topic_binding.dart';
import 'package:shia_game_flutter/features/topic/presentation/ui/topic_page.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/battle_league_topic_page.dart';
class Routes {
static const Routes _i = Routes._internal();
@ -30,8 +31,12 @@ class Routes {
static const String shopPage = '/shop_page';
static const String awardsPage = '/awards_page';
static const String profilePage = '/profile_page';
/// Battle league
static const String battleLeaguePage = '/battle_league_page';
static const String topicPage = '/topic_page';
static const String battleLeagueTopicPage = '/battle_league_topic_page';
static const String battleLeagueFindingPage = '/battle_league_finding_page';
static const String battleLeagueFoundedPage = '/battle_league_founded_page';
}
final List<GetPage> appPages = [
@ -78,8 +83,18 @@ final List<GetPage> appPages = [
binding: BattleLeagueBinding(),
),
GetPage(
name: Routes.topicPage,
page: () => const TopicPage(),
binding: TopicBinding(),
name: Routes.battleLeagueTopicPage,
page: () => const BattleLeagueTopicPage(),
binding: BattleLeagueBinding(),
),
GetPage(
name: Routes.battleLeagueFindingPage,
page: () => const BattleLeagueFindingPage(),
binding: BattleLeagueBinding(),
),
GetPage(
name: Routes.battleLeagueFoundedPage,
page: () => const BattleLeagueFoundedPage(),
binding: BattleLeagueBinding(),
),
];

61
lib/core/widgets/loading/my_linear_loading.dart

@ -0,0 +1,61 @@
import 'package:flutter/material.dart';
import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart';
import 'package:shia_game_flutter/core/utils/my_localization.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
class MyLinearLoading extends StatelessWidget {
const MyLinearLoading({
super.key,
});
@override
Widget build(BuildContext context) {
return Column(
spacing: 10.h,
mainAxisSize: MainAxisSize.min,
children: [
Text(
context.translate.loading,
style: Lexend.regular.copyWith(fontSize: 12.sp),
),
Container(
width: 188.w,
height: 16.h,
padding: const EdgeInsetsDirectional.only(
start: 2,
top: 2,
bottom: 2,
end: 20,
),
decoration: const ShapeDecoration(
shape: StadiumBorder(
side: BorderSide(
width: 1,
color: Color(0XFFA579EA),
),
),
),
child: Container(
height: 14.h,
decoration: ShapeDecoration(
shape: StadiumBorder(
side: BorderSide(
width: 1,
color: Colors.white.withValues(alpha: 0.5),
),
),
gradient: const LinearGradient(
begin: AlignmentDirectional.centerStart,
end: AlignmentDirectional.centerEnd,
colors: [
Color(0XFF9C7EEC),
Color(0XFF3BBDFF),
],
),
),
),
),
],
);
}
}

9
lib/features/battle_league/presentation/controller/battle_league_controller.dart

@ -40,7 +40,14 @@ class BattleLeagueController extends GetxController
/// ------ Functions ------
void goToTopicPage(){
Get.toNamed(Routes.topicPage);
Get.toNamed(Routes.battleLeagueTopicPage);
}
void goToFindingPage(){
Get.toNamed(Routes.battleLeagueFindingPage);
}
void goToFoundedPage(){
Get.toNamed(Routes.battleLeagueFoundedPage);
}
/// ------ Api Calls ------

140
lib/features/battle_league/presentation/ui/battle_find_page.dart

@ -1,140 +0,0 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:shia_game_flutter/common_ui/resources/my_assets.dart';
import 'package:shia_game_flutter/common_ui/resources/my_colors.dart';
import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart';
import 'package:shia_game_flutter/core/utils/gap.dart';
import 'package:shia_game_flutter/core/utils/my_localization.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
import 'package:shia_game_flutter/core/widgets/container/my_container.dart';
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/features/battle_league/presentation/controller/battle_league_controller.dart';
class BattleFindPage extends GetView<BattleLeagueController> {
const BattleFindPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColors.battleLeagueBackgroundColor,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: Column(
children: [
20.h.gapHeight,
_rankTitle(context),
const Spacer(),
_findingImage(context),
const Spacer(),
_description(context),
37.h.gapHeight,
const BattlePurpleButton(),
],
),
),
),
);
}
Container _rankTitle(BuildContext context) {
return Container(
height: 42.h,
width: context.widthScreen,
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 17),
decoration: const ShapeDecoration(
shape: StadiumBorder(),
color: Color(0XFF2E0869),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: FittedBox(
child: Text(
'${context.translate.quiz_league} (june) | ${context.translate.your_place} (1,569)',
textAlign: TextAlign.center,
maxLines: 1,
style: Lexend.semiBold.copyWith(fontSize: 12.sp),
),
),
),
15.w.gapWidth,
const MyImage(asset: MyAssets.iconRank),
4.w.gapWidth,
Text('265', style: Lexend.bold.copyWith(fontSize: 12.sp)),
],
),
);
}
Widget _findingImage(BuildContext context) {
return Stack(
alignment: Alignment.center,
children: [
const MyImage(asset: MyAssets.worldMap),
const MyImage(asset: MyAssets.magnifier),
Positioned(
bottom: 0,
child: Text(
context.translate.finding_player,
style: Lexend.semiBold.copyWith(fontSize: 20.sp),
),
),
],
);
}
Column _description(BuildContext context) {
return Column(
children: [
Text('،،', style: Lexend.black.copyWith(fontSize: 84.sp, height: 1)),
Text(
context.translate.find_hint,
textAlign: TextAlign.center,
style: Lexend.regular.copyWith(
fontSize: 14.sp,
color: const Color(0XFFC9B7E8),
),
),
],
);
}
}
class BattlePurpleButton extends StatelessWidget {
const BattlePurpleButton({super.key});
@override
Widget build(BuildContext context) {
return MyContainer(
onTap: () {},
width: context.widthScreen,
height: 64.h,
borderRadius: const BorderRadius.all(Radius.circular(20)),
borderGradient: LinearGradient(
begin: AlignmentDirectional.topStart,
end: AlignmentDirectional.bottomEnd,
colors: [
const Color(0XFF7F4CD4),
const Color(0XFF7F4CD4).withValues(alpha: 0),
],
),
gradient: const RadialGradient(
radius: 5,
center: Alignment(-0.5, 0),
colors: [Color(0xFF6A36BF), Color(0xFF562A9E)],
),
child: GradientText(
text: context.translate.stop_finding,
fontSize: 22.sp,
color: const Color(0xFFE1E1E1),
offset: const Offset(0, 1.04),
blurRadius: 1.9,
shadowColor: const Color(0xFF898989),
),
);
}
}

80
lib/features/battle_league/presentation/ui/battle_league_finding_page.dart

@ -0,0 +1,80 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:shia_game_flutter/common_ui/resources/my_assets.dart';
import 'package:shia_game_flutter/common_ui/resources/my_colors.dart';
import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart';
import 'package:shia_game_flutter/core/utils/gap.dart';
import 'package:shia_game_flutter/core/utils/my_localization.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
import 'package:shia_game_flutter/core/widgets/image/my_image.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/controller/battle_league_controller.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/button/battle_purple_button.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/rank_title.dart';
class BattleLeagueFindingPage extends GetView<BattleLeagueController> {
const BattleLeagueFindingPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColors.battleLeagueBackgroundColor,
body: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: Column(
children: [
20.h.gapHeight,
const RankTitle(),
const Spacer(),
_findingImage(context),
const Spacer(),
_description(context),
37.h.gapHeight,
_startFindingButton(context),
],
),
),
),
);
}
Widget _findingImage(BuildContext context) {
return Stack(
alignment: Alignment.center,
children: [
const MyImage(asset: MyAssets.worldMap),
const MyImage(asset: MyAssets.magnifier),
Positioned(
bottom: 0,
child: Text(
context.translate.finding_player,
style: Lexend.semiBold.copyWith(fontSize: 20.sp),
),
),
],
);
}
Column _description(BuildContext context) {
return Column(
children: [
Text('،،', style: Lexend.black.copyWith(fontSize: 84.sp, height: 1)),
Text(
context.translate.find_hint,
textAlign: TextAlign.center,
style: Lexend.regular.copyWith(
fontSize: 14.sp,
color: const Color(0XFFC9B7E8),
),
),
],
);
}
Widget _startFindingButton(BuildContext context) {
return BattlePurpleButton(
label: context.translate.stop_finding,
onTap: controller.goToFoundedPage,
);
}
}

59
lib/features/battle_league/presentation/ui/battle_league_founded_page.dart

@ -0,0 +1,59 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:shia_game_flutter/common_ui/resources/my_assets.dart';
import 'package:shia_game_flutter/common_ui/resources/my_colors.dart';
import 'package:shia_game_flutter/core/utils/gap.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
import 'package:shia_game_flutter/core/widgets/image/my_image.dart';
import 'package:shia_game_flutter/core/widgets/loading/my_linear_loading.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/controller/battle_league_controller.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/founded_page/founded_avatar.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/rank_title.dart';
class BattleLeagueFoundedPage extends GetView<BattleLeagueController> {
const BattleLeagueFoundedPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: MyColors.battleLeagueBackgroundColor,
body: DecoratedBox(
decoration: const BoxDecoration(
image: DecorationImage(image: AssetImage(MyAssets.union)),
),
child: SafeArea(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: Column(
children: [
20.h.gapHeight,
const RankTitle(),
50.h.gapHeight,
const FoundedAvatar(),
_image(),
const FoundedAvatar(),
50.h.gapHeight,
const MyLinearLoading(),
],
),
),
),
),
);
}
Flexible _image() {
return Flexible(
child: Stack(
alignment: Alignment.center,
children: [
Transform.scale(
scale: 2,
child: const MyImage(asset: MyAssets.electro, fit: BoxFit.cover),
),
const MyImage(asset: MyAssets.vs),
],
),
);
}
}

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

@ -7,10 +7,10 @@ import 'package:shia_game_flutter/core/utils/screen_size.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/features/battle_league/presentation/controller/battle_league_controller.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/battle_league_start_button.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/battle_league_tab_bar.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/regional_ranking.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/time_ranking.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/button/battle_golden_button.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/battle_league_tab_bar.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/regional_ranking.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/time_ranking.dart';
class BattleLeaguePage extends GetView<BattleLeagueController> {
const BattleLeaguePage({super.key});
@ -75,7 +75,7 @@ class BattleLeaguePage extends GetView<BattleLeagueController> {
Padding _startButton(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: BattleLeagueStartButton(
child: BattleGoldenButton(
title: context.translate.play_now,
onTap: controller.goToTopicPage,
),

17
lib/features/topic/presentation/ui/topic_page.dart → lib/features/battle_league/presentation/ui/battle_league_topic_page.dart

@ -8,13 +8,13 @@ import 'package:shia_game_flutter/core/utils/my_localization.dart';
import 'package:shia_game_flutter/core/utils/screen_size.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/features/battle_league/presentation/ui/widgets/battle_league_start_button.dart';
import 'package:shia_game_flutter/features/topic/presentation/controller/topic_controller.dart';
import 'package:shia_game_flutter/features/topic/presentation/ui/widgets/battle_grey_button.dart';
import 'package:shia_game_flutter/features/topic/presentation/ui/widgets/topic_widget.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/controller/battle_league_controller.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/button/battle_golden_button.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/button/battle_grey_button.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/topic_page/topic_widget.dart';
class TopicPage extends GetView<TopicController> {
const TopicPage({super.key});
class BattleLeagueTopicPage extends GetView<BattleLeagueController> {
const BattleLeagueTopicPage({super.key});
@override
Widget build(BuildContext context) {
@ -104,7 +104,10 @@ class TopicPage extends GetView<TopicController> {
Widget _startButton(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: BattleLeagueStartButton(title: context.translate.start_finding),
child: BattleGoldenButton(
onTap: controller.goToFindingPage,
title: context.translate.start_finding,
),
);
}
}

4
lib/features/battle_league/presentation/ui/widgets/battle_league_start_button.dart → lib/features/battle_league/presentation/ui/widgets/button/battle_golden_button.dart

@ -3,8 +3,8 @@ import 'package:shia_game_flutter/core/utils/screen_size.dart';
import 'package:shia_game_flutter/core/widgets/container/my_container.dart';
import 'package:shia_game_flutter/core/widgets/text/gradient_text.dart';
class BattleLeagueStartButton extends StatelessWidget {
const BattleLeagueStartButton({
class BattleGoldenButton extends StatelessWidget {
const BattleGoldenButton({
super.key,
this.onTap,
this.title,

0
lib/features/topic/presentation/ui/widgets/battle_grey_button.dart → lib/features/battle_league/presentation/ui/widgets/button/battle_grey_button.dart

42
lib/features/battle_league/presentation/ui/widgets/button/battle_purple_button.dart

@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
import 'package:shia_game_flutter/core/widgets/container/my_container.dart';
import 'package:shia_game_flutter/core/widgets/text/gradient_text.dart';
class BattlePurpleButton extends StatelessWidget {
const BattlePurpleButton({super.key, this.onTap, this.label});
final VoidCallback? onTap;
final String? label;
@override
Widget build(BuildContext context) {
return MyContainer(
onTap: onTap,
width: context.widthScreen,
height: 64.h,
borderRadius: const BorderRadius.all(Radius.circular(20)),
borderGradient: LinearGradient(
begin: AlignmentDirectional.topStart,
end: AlignmentDirectional.bottomEnd,
colors: [
const Color(0XFF7F4CD4),
const Color(0XFF7F4CD4).withValues(alpha: 0),
],
),
gradient: const RadialGradient(
radius: 5,
center: Alignment(-0.5, 0),
colors: [Color(0xFF6A36BF), Color(0xFF562A9E)],
),
child: GradientText(
text: label,
fontSize: 22.sp,
color: const Color(0xFFE1E1E1),
offset: const Offset(0, 1.04),
blurRadius: 1.9,
shadowColor: const Color(0xFF898989),
),
);
}
}

63
lib/features/battle_league/presentation/ui/widgets/founded_page/founded_avatar.dart

@ -0,0 +1,63 @@
import 'package:flutter/material.dart';
import 'package:shia_game_flutter/common_ui/resources/my_assets.dart';
import 'package:shia_game_flutter/common_ui/resources/my_colors.dart';
import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart';
import 'package:shia_game_flutter/core/utils/gap.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
import 'package:shia_game_flutter/core/widgets/image/my_image.dart';
class FoundedAvatar extends StatelessWidget {
const FoundedAvatar({super.key});
@override
Widget build(BuildContext context) {
return Column(
children: [
Stack(
alignment: Alignment.center,
clipBehavior: Clip.none,
children: [
Container(
width: 106,
height: 106,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(width: 1, color: MyColors.white),
),
child: const CircleAvatar(
foregroundImage: AssetImage(MyAssets.character1),
),
),
Positioned(
top: -10,
child: Container(
padding: const EdgeInsets.symmetric(vertical: 6, horizontal: 4),
decoration: const ShapeDecoration(
shape: StadiumBorder(),
color: MyColors.white,
),
child: Text(
'2,567',
style: Lexend.semiBold.copyWith(
fontSize: 12.sp,
color: const Color(0XFF784AC0),
),
),
),
),
],
),
16.h.gapHeight,
Text('Jack William', style: Lexend.bold.copyWith(fontSize: 16.sp)),
Row(
mainAxisSize: MainAxisSize.min,
spacing: 10,
children: [
const MyImage(asset: MyAssets.iconIran),
Text('Iran', style: Lexend.medium.copyWith(fontSize: 14.sp)),
],
),
],
);
}
}

0
lib/features/battle_league/presentation/ui/widgets/battle_league_tab_bar.dart → lib/features/battle_league/presentation/ui/widgets/main_page/battle_league_tab_bar.dart

0
lib/features/battle_league/presentation/ui/widgets/filter_ranking_button.dart → lib/features/battle_league/presentation/ui/widgets/main_page/filter_ranking_button.dart

0
lib/features/battle_league/presentation/ui/widgets/my_ranking_widget.dart → lib/features/battle_league/presentation/ui/widgets/main_page/my_ranking_widget.dart

0
lib/features/battle_league/presentation/ui/widgets/ranking_region.dart → lib/features/battle_league/presentation/ui/widgets/main_page/ranking_region.dart

0
lib/features/battle_league/presentation/ui/widgets/ranking_scrollbar.dart → lib/features/battle_league/presentation/ui/widgets/main_page/ranking_scrollbar.dart

0
lib/features/battle_league/presentation/ui/widgets/ranking_time.dart → lib/features/battle_league/presentation/ui/widgets/main_page/ranking_time.dart

0
lib/features/battle_league/presentation/ui/widgets/ranking_widget.dart → lib/features/battle_league/presentation/ui/widgets/main_page/ranking_widget.dart

10
lib/features/battle_league/presentation/ui/widgets/regional_ranking.dart → lib/features/battle_league/presentation/ui/widgets/main_page/regional_ranking.dart

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
import 'package:shia_game_flutter/core/utils/gap.dart';
import 'package:shia_game_flutter/core/utils/my_localization.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/filter_ranking_button.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/my_ranking_widget.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/ranking_region.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/ranking_scrollbar.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/ranking_widget.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/filter_ranking_button.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/my_ranking_widget.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/ranking_region.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/ranking_scrollbar.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/ranking_widget.dart';
class RegionalRanking extends StatefulWidget {
const RegionalRanking({super.key});

10
lib/features/battle_league/presentation/ui/widgets/time_ranking.dart → lib/features/battle_league/presentation/ui/widgets/main_page/time_ranking.dart

@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
import 'package:shia_game_flutter/core/utils/gap.dart';
import 'package:shia_game_flutter/core/utils/my_localization.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/filter_ranking_button.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/my_ranking_widget.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/ranking_scrollbar.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/ranking_time.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/ranking_widget.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/filter_ranking_button.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/my_ranking_widget.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/ranking_scrollbar.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/ranking_widget.dart';
import 'package:shia_game_flutter/features/battle_league/presentation/ui/widgets/main_page/ranking_time.dart';
class TimeRanking extends StatefulWidget {
const TimeRanking({super.key});

44
lib/features/battle_league/presentation/ui/widgets/rank_title.dart

@ -0,0 +1,44 @@
import 'package:flutter/material.dart';
import 'package:shia_game_flutter/common_ui/resources/my_assets.dart';
import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart';
import 'package:shia_game_flutter/core/utils/gap.dart';
import 'package:shia_game_flutter/core/utils/my_localization.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
import 'package:shia_game_flutter/core/widgets/image/my_image.dart';
class RankTitle extends StatelessWidget {
const RankTitle({super.key});
@override
Widget build(BuildContext context) {
return Container(
height: 42.h,
width: context.widthScreen,
alignment: Alignment.center,
padding: const EdgeInsets.symmetric(horizontal: 17),
decoration: const ShapeDecoration(
shape: StadiumBorder(),
color: Color(0XFF2E0869),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: FittedBox(
child: Text(
'${context.translate.quiz_league} (june) | ${context.translate.your_place} (1,569)',
textAlign: TextAlign.center,
maxLines: 1,
style: Lexend.semiBold.copyWith(fontSize: 12.sp),
),
),
),
15.w.gapWidth,
const MyImage(asset: MyAssets.iconRank),
4.w.gapWidth,
Text('265', style: Lexend.bold.copyWith(fontSize: 12.sp)),
],
),
);
}
}

0
lib/features/topic/presentation/ui/widgets/topic_widget.dart → lib/features/battle_league/presentation/ui/widgets/topic_page/topic_widget.dart

16
lib/features/intro/presentation/ui/intro_page.dart

@ -1,13 +1,11 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:shia_game_flutter/common_ui/resources/my_assets.dart';
import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart';
import 'package:shia_game_flutter/common_ui/theme/my_theme.dart';
import 'package:shia_game_flutter/core/utils/my_localization.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
import 'package:shia_game_flutter/core/widgets/image/my_image.dart';
import 'package:shia_game_flutter/core/widgets/loading/my_linear_loading.dart';
import 'package:shia_game_flutter/features/intro/presentation/controller/intro_controller.dart';
import 'package:shia_game_flutter/features/intro/presentation/ui/widgets/intro_loading.dart';
class IntroPage extends GetView<IntroController> {
const IntroPage({super.key});
@ -82,17 +80,7 @@ class IntroPage extends GetView<IntroController> {
Positioned _bottomLoading(BuildContext context) {
return Positioned(
bottom: 16.h,
child: Column(
spacing: 10.h,
mainAxisSize: MainAxisSize.min,
children: [
Text(
context.translate.loading,
style: Lexend.regular.copyWith(fontSize: 12.sp),
),
const IntroLoading(),
],
),
child: const MyLinearLoading()
);
}
}

48
lib/features/intro/presentation/ui/widgets/intro_loading.dart

@ -1,49 +1 @@
import 'package:flutter/material.dart';
import 'package:shia_game_flutter/core/utils/screen_size.dart';
class IntroLoading extends StatelessWidget {
const IntroLoading({
super.key,
});
@override
Widget build(BuildContext context) {
return Container(
width: 188.w,
height: 16.h,
padding: const EdgeInsetsDirectional.only(
start: 2,
top: 2,
bottom: 2,
end: 20,
),
decoration: const ShapeDecoration(
shape: StadiumBorder(
side: BorderSide(
width: 1,
color: Color(0XFFA579EA),
),
),
),
child: Container(
height: 14.h,
decoration: ShapeDecoration(
shape: StadiumBorder(
side: BorderSide(
width: 1,
color: Colors.white.withValues(alpha: 0.5),
),
),
gradient: const LinearGradient(
begin: AlignmentDirectional.centerStart,
end: AlignmentDirectional.centerEnd,
colors: [
Color(0XFF9C7EEC),
Color(0XFF3BBDFF),
],
),
),
),
);
}
}

28
lib/features/topic/data/datasource/topic_datasource.dart

@ -1,28 +0,0 @@
import 'package:shia_game_flutter/core/constants/my_api.dart';
import 'package:shia_game_flutter/core/network/http_request.dart';
import 'package:shia_game_flutter/core/params/topic_params.dart';
import 'package:shia_game_flutter/core/response/base_response.dart';
import 'package:shia_game_flutter/features/topic/data/model/topic_model.dart';
import 'package:shia_game_flutter/features/topic/domain/entity/topic_entity.dart';
abstract class ITopicDatasource {
Future<TopicEntity> getData({required TopicParams params});
}
class TopicDatasourceImpl implements ITopicDatasource {
final IHttpRequest httpRequest;
const TopicDatasourceImpl(this.httpRequest);
@override
Future<TopicEntity> getData({required TopicParams params}) async {
final response = await httpRequest.get(
path: MyApi.baseUrl,
);
return BaseResponse.getData<TopicEntity>(
response?['data'],
(json) => TopicModel.fromJson(json),
);
}
}

13
lib/features/topic/data/model/topic_model.dart

@ -1,13 +0,0 @@
import 'package:shia_game_flutter/features/topic/domain/entity/topic_entity.dart';
class TopicModel extends TopicEntity {
const TopicModel({
super.id,
});
factory TopicModel.fromJson(Map<String, dynamic> json) {
return TopicModel(
id: json['id'],
);
}
}

29
lib/features/topic/data/repository_impl/topic_repository_impl.dart

@ -1,29 +0,0 @@
import 'package:flutter/foundation.dart';
import 'package:shia_game_flutter/core/error_handler/my_exception.dart';
import 'package:shia_game_flutter/core/params/topic_params.dart';
import 'package:shia_game_flutter/core/utils/data_state.dart';
import 'package:shia_game_flutter/features/topic/data/datasource/topic_datasource.dart';
import 'package:shia_game_flutter/features/topic/domain/entity/topic_entity.dart';
import 'package:shia_game_flutter/features/topic/domain/repository/topic_repository.dart';
class TopicRepositoryImpl implements ITopicRepository {
final ITopicDatasource datasource;
const TopicRepositoryImpl(this.datasource);
@override
Future<DataState<TopicEntity, MyException>> getData({required TopicParams params}) async {
try {
final TopicEntity response = await datasource.getData(params: params);
return DataState.success(response);
} on MyException catch (e) {
return DataState.error(e);
} catch (e) {
if (kDebugMode) {
rethrow;
} else {
return DataState.error(MyException(errorMessage: '$e'));
}
}
}
}

14
lib/features/topic/domain/entity/topic_entity.dart

@ -1,14 +0,0 @@
import 'package:equatable/equatable.dart';
class TopicEntity extends Equatable {
final int? id;
const TopicEntity({
this.id,
});
@override
List<Object?> get props => [
id,
];
}

8
lib/features/topic/domain/repository/topic_repository.dart

@ -1,8 +0,0 @@
import 'package:shia_game_flutter/core/error_handler/my_exception.dart';
import 'package:shia_game_flutter/core/params/topic_params.dart';
import 'package:shia_game_flutter/core/utils/data_state.dart';
import 'package:shia_game_flutter/features/topic/domain/entity/topic_entity.dart';
abstract class ITopicRepository {
Future<DataState<TopicEntity, MyException>> getData({required TopicParams params});
}

19
lib/features/topic/domain/usecases/get_topic_usecase.dart

@ -1,19 +0,0 @@
import 'package:shia_game_flutter/core/error_handler/my_exception.dart';
import 'package:shia_game_flutter/core/params/topic_params.dart';
import 'package:shia_game_flutter/core/usecase/usecase.dart';
import 'package:shia_game_flutter/core/utils/data_state.dart';
import 'package:shia_game_flutter/features/topic/domain/entity/topic_entity.dart';
import 'package:shia_game_flutter/features/topic/domain/repository/topic_repository.dart';
class GetTopicUseCase implements UseCase<TopicEntity, TopicParams> {
final ITopicRepository repository;
const GetTopicUseCase(this.repository);
@override
Future<DataState<TopicEntity, MyException>> call(TopicParams params) {
return repository.getData(params: params);
}
}

20
lib/features/topic/presentation/binding/topic_binding.dart

@ -1,20 +0,0 @@
import 'package:shia_game_flutter/features/topic/presentation/controller/topic_controller.dart';
import 'package:get/get.dart';
class TopicBinding extends Bindings {
@override
void dependencies() {
Get.put<TopicController>(TopicController(Get.find()));
}
Future<void> deleteBindings() async {
await Future.wait([
Get.delete<TopicController>(),
]);
}
Future<void> refreshBinding() async {
await deleteBindings();
dependencies();
}
}

54
lib/features/topic/presentation/controller/topic_controller.dart

@ -1,54 +0,0 @@
import 'package:flutter/cupertino.dart';
import 'package:shia_game_flutter/core/params/topic_params.dart';
import 'package:shia_game_flutter/core/status/base_status.dart';
import 'package:shia_game_flutter/features/topic/domain/entity/topic_entity.dart';
import 'package:shia_game_flutter/features/topic/domain/usecases/get_topic_usecase.dart';
import 'package:get/get.dart';
class TopicController extends GetxController with StateMixin {
/// ----- Constructor -----
TopicController(this.getTopicUseCase);
@override
void onInit() {
super.onInit();
change('', status: RxStatus.success());
}
@override
void onClose() {
textEditingController.dispose();
super.onClose();
}
/// ----- UseCases -----
final GetTopicUseCase getTopicUseCase;
/// ----- Variables -----
final Rx<TopicParams> topicParams = Rx(TopicParams());
final Rx<TopicEntity> topicEntity = Rx(const TopicEntity());
/// ------ Controllers ------
final TextEditingController textEditingController = TextEditingController();
/// ------ Statuses ------
final Rx<BaseStatus> getTopicStatus = Rx(const BaseInit());
/// ------ Functions ------
/// ------ Api Calls ------
Future<void> getTopic() async {
change('', status: RxStatus.loading());
await getTopicUseCase(topicParams.value).then(
(value) => value.fold(
(data) {
topicEntity.value = data;
change('', status: RxStatus.success());
},
(error) {
change('', status: RxStatus.error(error.errorMessage));
},
),
);
}
}

9
lib/init_bindings.dart

@ -33,10 +33,6 @@ import 'package:shia_game_flutter/features/shop/data/datasource/shop_datasource.
import 'package:shia_game_flutter/features/shop/data/repository_impl/shop_repository_impl.dart';
import 'package:shia_game_flutter/features/shop/domain/repository/shop_repository.dart';
import 'package:shia_game_flutter/features/shop/domain/usecases/get_shop_usecase.dart';
import 'package:shia_game_flutter/features/topic/data/datasource/topic_datasource.dart';
import 'package:shia_game_flutter/features/topic/data/repository_impl/topic_repository_impl.dart';
import 'package:shia_game_flutter/features/topic/domain/repository/topic_repository.dart';
import 'package:shia_game_flutter/features/topic/domain/usecases/get_topic_usecase.dart';
void initBindings() {
/// ----- Classes -----
@ -81,9 +77,4 @@ void initBindings() {
Get.lazyPut<IBattleLeagueDatasource>(() => BattleLeagueDatasourceImpl(Get.find()), fenix: true);
Get.lazyPut<IBattleLeagueRepository>(() => BattleLeagueRepositoryImpl(Get.find()), fenix: true);
Get.lazyPut<GetBattleLeagueUseCase>(() => GetBattleLeagueUseCase(Get.find()), fenix: true);
/// ----- Topic Feature -----
Get.lazyPut<ITopicDatasource>(() => TopicDatasourceImpl(Get.find()), fenix: true);
Get.lazyPut<ITopicRepository>(() => TopicRepositoryImpl(Get.find()), fenix: true);
Get.lazyPut<GetTopicUseCase>(() => GetTopicUseCase(Get.find()), fenix: true);
}
Loading…
Cancel
Save