25 changed files with 560 additions and 2 deletions
-
BINassets/images/icon_profile.png
-
41assets/svg/icon_awards.svg
-
41assets/svg/icon_home.svg
-
41assets/svg/icon_shop.svg
-
4lib/common_ui/resources/my_assets.dart
-
13lib/core/params/home_params.dart
-
8lib/core/routers/my_routes.dart
-
74lib/core/widgets/bottom_nav_bar/bottom_nav_bar.dart
-
26lib/core/widgets/bottom_nav_bar/styles/bottom_nav_bar_item.dart
-
38lib/core/widgets/bottom_nav_bar/styles/bottom_nav_bar_profile_item.dart
-
28lib/features/home/data/datasource/home_datasource.dart
-
13lib/features/home/data/model/home_model.dart
-
29lib/features/home/data/repository_impl/home_repository_impl.dart
-
11lib/features/home/domain/entity/bottom_nav_entity.dart
-
14lib/features/home/domain/entity/home_entity.dart
-
8lib/features/home/domain/repository/home_repository.dart
-
17lib/features/home/domain/usecases/get_home_usecase.dart
-
9lib/features/home/presentation/binding/home_binding.dart
-
81lib/features/home/presentation/controller/home_controller.dart
-
13lib/features/home/presentation/pages/home_page.dart
-
9lib/init_bindings.dart
-
6lib/l10n/app_en.arb
-
24lib/l10n/app_localizations.dart
-
12lib/l10n/app_localizations_en.dart
-
2lib/main.dart
|
After Width: 18 | Height: 18 | Size: 1.1 KiB |
@ -0,0 +1,41 @@ |
|||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
||||
|
<g clip-path="url(#clip0_1_9467)"> |
||||
|
<g filter="url(#filter0_d_1_9467)"> |
||||
|
<path d="M21.5846 8.04998V8.11994C21.5846 8.9441 21.5846 9.35715 21.3863 9.69448C21.1879 10.0318 20.8266 10.2321 20.1059 10.6336L19.346 11.0553C19.8692 9.28431 20.0446 7.38106 20.1088 5.75381L20.1184 5.54202L20.1203 5.49219C20.7442 5.70877 21.0949 5.87073 21.3134 6.17356C21.5846 6.55019 21.5846 7.05044 21.5846 8.04998ZM2.41797 8.04998V8.11994C2.41797 8.9441 2.41797 9.35715 2.61634 9.69448C2.81472 10.0318 3.17601 10.2321 3.89668 10.6336L4.65759 11.0553C4.13338 9.28431 3.95801 7.38106 3.8938 5.75381L3.88422 5.54202L3.88326 5.49219C3.25843 5.70877 2.90768 5.87073 2.68918 6.17356C2.41797 6.55019 2.41797 7.0514 2.41797 8.04998Z" fill="url(#paint0_linear_1_9467)"/> |
||||
|
</g> |
||||
|
<g filter="url(#filter1_d_1_9467)"> |
||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M16.1949 2.47729C14.8084 2.25016 13.4053 2.13893 12.0003 2.14475C10.2916 2.14475 8.88282 2.29521 7.80565 2.47729C6.71411 2.66129 6.16882 2.75329 5.71265 3.31487C5.25744 3.87646 5.2814 4.48308 5.32932 5.69633C5.49511 9.86316 6.39403 15.0688 11.2815 15.5288V18.9156H9.91111C9.68965 18.9157 9.47506 18.9925 9.30385 19.133C9.13263 19.2735 9.01535 19.4689 8.97194 19.6861L8.78986 20.5927H6.25028C6.05965 20.5927 5.87683 20.6684 5.74204 20.8032C5.60725 20.938 5.53153 21.1208 5.53153 21.3114C5.53153 21.502 5.60725 21.6849 5.74204 21.8196C5.87683 21.9544 6.05965 22.0302 6.25028 22.0302H17.7503C17.9409 22.0302 18.1237 21.9544 18.2585 21.8196C18.3933 21.6849 18.469 21.502 18.469 21.3114C18.469 21.1208 18.3933 20.938 18.2585 20.8032C18.1237 20.6684 17.9409 20.5927 17.7503 20.5927H15.2107L15.0286 19.6861C14.9852 19.4689 14.8679 19.2735 14.6967 19.133C14.5255 18.9925 14.3109 18.9157 14.0894 18.9156H12.719V15.5288C17.6065 15.0688 18.5064 9.86412 18.6712 5.69633C18.7192 4.48308 18.7441 3.8755 18.2879 3.31487C17.8317 2.75329 17.2864 2.66129 16.1949 2.47729Z" fill="url(#paint1_linear_1_9467)"/> |
||||
|
</g> |
||||
|
</g> |
||||
|
<defs> |
||||
|
<filter id="filter0_d_1_9467" x="2.41797" y="5.49219" width="19.168" height="7.05456" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> |
||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/> |
||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> |
||||
|
<feOffset dy="1.49206"/> |
||||
|
<feComposite in2="hardAlpha" operator="out"/> |
||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.393994 0 0 0 0 0.367696 0 0 0 0 0.788462 0 0 0 1 0"/> |
||||
|
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_9467"/> |
||||
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_9467" result="shape"/> |
||||
|
</filter> |
||||
|
<filter id="filter1_d_1_9467" x="5.30469" y="2.14453" width="13.3906" height="21.3768" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> |
||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/> |
||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> |
||||
|
<feOffset dy="1.49206"/> |
||||
|
<feComposite in2="hardAlpha" operator="out"/> |
||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.393994 0 0 0 0 0.367696 0 0 0 0 0.788462 0 0 0 1 0"/> |
||||
|
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_9467"/> |
||||
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_9467" result="shape"/> |
||||
|
</filter> |
||||
|
<linearGradient id="paint0_linear_1_9467" x1="11.0739" y1="6.58494" x2="11.0739" y2="11.6514" gradientUnits="userSpaceOnUse"> |
||||
|
<stop stop-color="#F4EEFF"/> |
||||
|
<stop offset="1" stop-color="#B3B1FF"/> |
||||
|
</linearGradient> |
||||
|
<linearGradient id="paint1_linear_1_9467" x1="11.3524" y1="6.05064" x2="11.3524" y2="24.1608" gradientUnits="userSpaceOnUse"> |
||||
|
<stop stop-color="#F4EEFF"/> |
||||
|
<stop offset="1" stop-color="#B3B1FF"/> |
||||
|
</linearGradient> |
||||
|
<clipPath id="clip0_1_9467"> |
||||
|
<rect width="23" height="23" fill="white" transform="translate(0.5 0.228516)"/> |
||||
|
</clipPath> |
||||
|
</defs> |
||||
|
</svg> |
||||
@ -0,0 +1,41 @@ |
|||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
||||
|
<g clip-path="url(#clip0_1_9457)"> |
||||
|
<g filter="url(#filter0_d_1_9457)"> |
||||
|
<path d="M12.2503 4.77937C12.1835 4.7154 12.0945 4.67969 12.0019 4.67969C11.9094 4.67969 11.8204 4.7154 11.7535 4.77937L3.4834 12.6798C3.44828 12.7134 3.42033 12.7537 3.40126 12.7985C3.38219 12.8432 3.37239 12.8913 3.37244 12.9399L3.37109 20.3547C3.37109 20.7359 3.52254 21.1016 3.79213 21.3711C4.06171 21.6407 4.42734 21.7922 4.80859 21.7922H9.12558C9.31621 21.7922 9.49902 21.7165 9.63382 21.5817C9.76861 21.4469 9.84433 21.2641 9.84433 21.0734V14.9641C9.84433 14.8687 9.8822 14.7773 9.94959 14.7099C10.017 14.6425 10.1084 14.6047 10.2037 14.6047H13.7975C13.8928 14.6047 13.9842 14.6425 14.0516 14.7099C14.119 14.7773 14.1568 14.8687 14.1568 14.9641V21.0734C14.1568 21.2641 14.2326 21.4469 14.3673 21.5817C14.5021 21.7165 14.685 21.7922 14.8756 21.7922H19.1908C19.572 21.7922 19.9377 21.6407 20.2072 21.3711C20.4768 21.1016 20.6283 20.7359 20.6283 20.3547V12.9399C20.6283 12.8913 20.6185 12.8432 20.5995 12.7985C20.5804 12.7537 20.5524 12.7134 20.5173 12.6798L12.2503 4.77937Z" fill="url(#paint0_linear_1_9457)"/> |
||||
|
</g> |
||||
|
<g filter="url(#filter1_d_1_9457)"> |
||||
|
<path d="M22.5526 11.1962L19.1925 7.98158V3.10352C19.1925 2.91289 19.1167 2.73007 18.9819 2.59528C18.8471 2.46049 18.6643 2.38477 18.4737 2.38477H16.3175C16.1268 2.38477 15.944 2.46049 15.8092 2.59528C15.6744 2.73007 15.5987 2.91289 15.5987 3.10352V4.54102L12.9968 2.05324C12.7534 1.80707 12.3913 1.66602 12 1.66602C11.6101 1.66602 11.2489 1.80707 11.0054 2.05369L1.45056 11.1953C1.17115 11.4648 1.13611 11.9082 1.39037 12.2002C1.45422 12.2739 1.53239 12.3338 1.62014 12.3764C1.70789 12.4189 1.80338 12.4431 1.90079 12.4476C1.9982 12.452 2.0955 12.4366 2.18676 12.4023C2.27803 12.3679 2.36135 12.3154 2.43166 12.2478L11.7529 3.3407C11.8198 3.27673 11.9088 3.24102 12.0014 3.24102C12.0939 3.24102 12.1829 3.27673 12.2498 3.3407L21.572 12.2478C21.7093 12.3795 21.8932 12.4514 22.0834 12.4477C22.2737 12.444 22.4547 12.365 22.5868 12.228C22.8626 11.9423 22.8397 11.4707 22.5526 11.1962Z" fill="url(#paint1_linear_1_9457)"/> |
||||
|
</g> |
||||
|
</g> |
||||
|
<defs> |
||||
|
<filter id="filter0_d_1_9457" x="3.37109" y="4.67969" width="17.2578" height="18.6053" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> |
||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/> |
||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> |
||||
|
<feOffset dy="1.49206"/> |
||||
|
<feComposite in2="hardAlpha" operator="out"/> |
||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.393994 0 0 0 0 0.367696 0 0 0 0 0.788462 0 0 0 1 0"/> |
||||
|
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_9457"/> |
||||
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_9457" result="shape"/> |
||||
|
</filter> |
||||
|
<filter id="filter1_d_1_9457" x="1.21875" y="1.66602" width="21.5625" height="12.2753" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> |
||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/> |
||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> |
||||
|
<feOffset dy="1.49206"/> |
||||
|
<feComposite in2="hardAlpha" operator="out"/> |
||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.393994 0 0 0 0 0.367696 0 0 0 0 0.788462 0 0 0 1 0"/> |
||||
|
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_9457"/> |
||||
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_9457" result="shape"/> |
||||
|
</filter> |
||||
|
<linearGradient id="paint0_linear_1_9457" x1="11.1647" y1="8.04107" x2="11.1647" y2="23.6257" gradientUnits="userSpaceOnUse"> |
||||
|
<stop stop-color="#F4EEFF"/> |
||||
|
<stop offset="1" stop-color="#B3B1FF"/> |
||||
|
</linearGradient> |
||||
|
<linearGradient id="paint1_linear_1_9457" x1="10.9567" y1="3.78397" x2="10.9567" y2="13.6036" gradientUnits="userSpaceOnUse"> |
||||
|
<stop stop-color="#F4EEFF"/> |
||||
|
<stop offset="1" stop-color="#B3B1FF"/> |
||||
|
</linearGradient> |
||||
|
<clipPath id="clip0_1_9457"> |
||||
|
<rect width="23" height="23" fill="white" transform="translate(0.5 0.228516)"/> |
||||
|
</clipPath> |
||||
|
</defs> |
||||
|
</svg> |
||||
@ -0,0 +1,41 @@ |
|||||
|
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> |
||||
|
<g clip-path="url(#clip0_1_9462)"> |
||||
|
<g filter="url(#filter0_d_1_9462)"> |
||||
|
<path d="M16.3377 2.14453H7.65906C6.50619 2.14453 5.93023 2.14453 5.46639 2.43107C5.00352 2.71666 4.74573 3.23224 4.23014 4.26341L2.8856 7.66453C2.57414 8.45036 2.30294 9.37611 2.82619 10.0402C3.07279 10.3532 3.41083 10.5816 3.79327 10.6936C4.17571 10.8055 4.58353 10.7955 4.96 10.6649C5.33647 10.5342 5.66286 10.2895 5.89378 9.96477C6.1247 9.64001 6.24865 9.25135 6.24839 8.85286C6.24839 9.36119 6.45033 9.84871 6.80977 10.2081C7.16922 10.5676 7.65673 10.7695 8.16506 10.7695C8.67339 10.7695 9.1609 10.5676 9.52035 10.2081C9.87979 9.84871 10.0817 9.36119 10.0817 8.85286C10.0817 9.36119 10.2837 9.84871 10.6431 10.2081C11.0026 10.5676 11.4901 10.7695 11.9984 10.7695C12.5067 10.7695 12.9942 10.5676 13.3537 10.2081C13.7131 9.84871 13.9151 9.36119 13.9151 8.85286C13.9151 9.36119 14.117 9.84871 14.4764 10.2081C14.8359 10.5676 15.3234 10.7695 15.8317 10.7695C16.3401 10.7695 16.8276 10.5676 17.187 10.2081C17.5465 9.84871 17.7484 9.36119 17.7484 8.85286C17.7483 9.25127 17.8724 9.63979 18.1034 9.96439C18.3344 10.289 18.6608 10.5336 19.0372 10.6641C19.4137 10.7946 19.8214 10.8045 20.2038 10.6925C20.5861 10.5806 20.924 10.3522 21.1706 10.0393C21.6939 9.37515 21.4217 8.4494 21.1112 7.66357L19.7657 4.26341C19.2501 3.23224 18.9933 2.71666 18.5294 2.43107C18.0666 2.14453 17.4896 2.14453 16.3377 2.14453Z" fill="url(#paint0_linear_1_9462)"/> |
||||
|
</g> |
||||
|
<g filter="url(#filter1_d_1_9462)"> |
||||
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M19.668 20.5937H21.5846C21.7753 20.5937 21.9581 20.6694 22.0929 20.8042C22.2277 20.939 22.3034 21.1218 22.3034 21.3125C22.3034 21.5031 22.2277 21.6859 22.0929 21.8207C21.9581 21.9555 21.7753 22.0312 21.5846 22.0312H2.41797C2.22734 22.0312 2.04453 21.9555 1.90974 21.8207C1.77494 21.6859 1.69922 21.5031 1.69922 21.3125C1.69922 21.1218 1.77494 20.939 1.90974 20.8042C2.04453 20.6694 2.22734 20.5937 2.41797 20.5937H4.33463V12.2083C5.04763 12.2083 5.70793 11.986 6.2513 11.6074C6.81381 11.9988 7.4827 12.2085 8.16797 12.2083C8.88097 12.2083 9.54126 11.986 10.0846 11.6074C10.6471 11.9988 11.316 12.2085 12.0013 12.2083C12.7143 12.2083 13.3746 11.986 13.918 11.6074C14.4805 11.9988 15.1494 12.2085 15.8346 12.2083C16.5476 12.2083 17.2079 11.986 17.7513 11.6074C18.3138 11.9988 18.9827 12.2085 19.668 12.2083V20.5937ZM9.60547 20.5937H14.3971V17.9583C14.3971 17.0623 14.3971 16.6147 14.2045 16.2812C14.0785 16.0624 13.897 15.8806 13.6784 15.7541C13.3449 15.5625 12.8973 15.5625 12.0013 15.5625C11.1053 15.5625 10.6577 15.5625 10.3242 15.7541C10.1056 15.8806 9.92412 16.0624 9.79809 16.2812C9.60547 16.6147 9.60547 17.0623 9.60547 17.9583V20.5937Z" fill="url(#paint1_linear_1_9462)"/> |
||||
|
</g> |
||||
|
</g> |
||||
|
<defs> |
||||
|
<filter id="filter0_d_1_9462" x="2.53125" y="2.14453" width="18.9336" height="10.119" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> |
||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/> |
||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> |
||||
|
<feOffset dy="1.49206"/> |
||||
|
<feComposite in2="hardAlpha" operator="out"/> |
||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.393994 0 0 0 0 0.367696 0 0 0 0 0.788462 0 0 0 1 0"/> |
||||
|
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_9462"/> |
||||
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_9462" result="shape"/> |
||||
|
</filter> |
||||
|
<filter id="filter1_d_1_9462" x="1.69922" y="11.6074" width="20.6055" height="11.9159" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB"> |
||||
|
<feFlood flood-opacity="0" result="BackgroundImageFix"/> |
||||
|
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/> |
||||
|
<feOffset dy="1.49206"/> |
||||
|
<feComposite in2="hardAlpha" operator="out"/> |
||||
|
<feColorMatrix type="matrix" values="0 0 0 0 0.393994 0 0 0 0 0.367696 0 0 0 0 0.788462 0 0 0 1 0"/> |
||||
|
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1_9462"/> |
||||
|
<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow_1_9462" result="shape"/> |
||||
|
</filter> |
||||
|
<linearGradient id="paint0_linear_1_9462" x1="11.0821" y1="3.83897" x2="11.0821" y2="11.695" gradientUnits="userSpaceOnUse"> |
||||
|
<stop stop-color="#F4EEFF"/> |
||||
|
<stop offset="1" stop-color="#B3B1FF"/> |
||||
|
</linearGradient> |
||||
|
<linearGradient id="paint1_linear_1_9462" x1="11.0043" y1="13.655" x2="11.0043" y2="23.1481" gradientUnits="userSpaceOnUse"> |
||||
|
<stop stop-color="#F4EEFF"/> |
||||
|
<stop offset="1" stop-color="#B3B1FF"/> |
||||
|
</linearGradient> |
||||
|
<clipPath id="clip0_1_9462"> |
||||
|
<rect width="23" height="23" fill="white" transform="translate(0.5 0.228516)"/> |
||||
|
</clipPath> |
||||
|
</defs> |
||||
|
</svg> |
||||
@ -0,0 +1,13 @@ |
|||||
|
class HomeParams { |
||||
|
int? id; |
||||
|
|
||||
|
HomeParams({this.id}); |
||||
|
|
||||
|
HomeParams copyWith({ |
||||
|
int? id, |
||||
|
}) { |
||||
|
return HomeParams( |
||||
|
id: id ?? this.id, |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,74 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:get/get_state_manager/src/rx_flutter/rx_obx_widget.dart'; |
||||
|
import 'package:get/get_state_manager/src/simple/get_view.dart'; |
||||
|
import 'package:shia_game_flutter/common_ui/resources/my_text_style.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/presentation/controller/home_controller.dart'; |
||||
|
import 'package:shia_game_flutter/core/widgets/bottom_nav_bar/styles/bottom_nav_bar_item.dart'; |
||||
|
import 'package:shia_game_flutter/core/widgets/bottom_nav_bar/styles/bottom_nav_bar_profile_item.dart'; |
||||
|
|
||||
|
class BottomNavBar extends GetView<HomeController> { |
||||
|
const BottomNavBar({super.key}); |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Container( |
||||
|
decoration: BoxDecoration( |
||||
|
gradient: RadialGradient( |
||||
|
radius: 2.5, |
||||
|
colors: [Color(0XFF4F09BF), Color(0XFF250459)], |
||||
|
), |
||||
|
), |
||||
|
child: Obx( |
||||
|
() => BottomNavigationBar( |
||||
|
onTap: (int index) => controller.onChangeBottomNavBar(index), |
||||
|
currentIndex: controller.selectedIndex.value, |
||||
|
backgroundColor: Colors.transparent, |
||||
|
elevation: 0, |
||||
|
type: BottomNavigationBarType.fixed, |
||||
|
unselectedFontSize: 8, |
||||
|
selectedFontSize: 8, |
||||
|
unselectedLabelStyle: Lexend.bold, |
||||
|
selectedLabelStyle: Lexend.bold, |
||||
|
showSelectedLabels: false, |
||||
|
showUnselectedLabels: false, |
||||
|
items: List.generate( |
||||
|
controller.bottomNavList.length, |
||||
|
(index) => index == 3 |
||||
|
? _bottomNavBarProfileItem(index) |
||||
|
: _bottomNavBarItem(index), |
||||
|
), |
||||
|
), |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
BottomNavigationBarItem _bottomNavBarItem(int index) { |
||||
|
return BottomNavigationBarItem( |
||||
|
icon: Opacity( |
||||
|
opacity: 0.7, |
||||
|
child: BottomNavBarItem( |
||||
|
bottomNavEntity: controller.bottomNavList[index], |
||||
|
), |
||||
|
), |
||||
|
activeIcon: BottomNavBarItem( |
||||
|
bottomNavEntity: controller.bottomNavList[index], |
||||
|
), |
||||
|
label: '', |
||||
|
); |
||||
|
} |
||||
|
|
||||
|
BottomNavigationBarItem _bottomNavBarProfileItem(int index) { |
||||
|
return BottomNavigationBarItem( |
||||
|
icon: Opacity( |
||||
|
opacity: 0.7, |
||||
|
child: BottomNavBarProfileItem( |
||||
|
bottomNavEntity: controller.bottomNavList[index], |
||||
|
), |
||||
|
), |
||||
|
activeIcon: BottomNavBarProfileItem( |
||||
|
bottomNavEntity: controller.bottomNavList[index], |
||||
|
), |
||||
|
label: '', |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,26 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:shia_game_flutter/common_ui/resources/my_spaces.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/widgets/image/my_image.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/domain/entity/bottom_nav_entity.dart'; |
||||
|
|
||||
|
class BottomNavBarItem extends StatelessWidget { |
||||
|
const BottomNavBarItem({super.key, required this.bottomNavEntity}); |
||||
|
|
||||
|
final BottomNavEntity bottomNavEntity; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Column( |
||||
|
children: [ |
||||
|
MyImage(asset: bottomNavEntity.icon ?? ''), |
||||
|
MySpaces.s4.gapHeight, |
||||
|
Text( |
||||
|
bottomNavEntity.title ?? '', |
||||
|
style: Lexend.bold.copyWith(fontSize: MySpaces.s8), |
||||
|
), |
||||
|
], |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:shia_game_flutter/common_ui/resources/my_spaces.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/widgets/image/my_image.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/domain/entity/bottom_nav_entity.dart'; |
||||
|
|
||||
|
class BottomNavBarProfileItem extends StatelessWidget { |
||||
|
const BottomNavBarProfileItem({super.key, required this.bottomNavEntity}); |
||||
|
|
||||
|
final BottomNavEntity bottomNavEntity; |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Column( |
||||
|
children: [ |
||||
|
Container( |
||||
|
height: 26, |
||||
|
width: 26, |
||||
|
padding: EdgeInsets.all(3), |
||||
|
decoration: BoxDecoration( |
||||
|
shape: BoxShape.circle, |
||||
|
border: Border.all( |
||||
|
width: 1, |
||||
|
color: Color(0XFFF4EEFF), |
||||
|
) |
||||
|
), |
||||
|
child: MyImage(asset: bottomNavEntity.icon ?? ''), |
||||
|
), |
||||
|
MySpaces.s4.gapHeight, |
||||
|
Text( |
||||
|
bottomNavEntity.title ?? '', |
||||
|
style: Lexend.bold.copyWith(fontSize: MySpaces.s8), |
||||
|
), |
||||
|
], |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
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/home_params.dart'; |
||||
|
import 'package:shia_game_flutter/core/response/base_response.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/data/model/home_model.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/domain/entity/home_entity.dart'; |
||||
|
|
||||
|
abstract class IHomeDatasource { |
||||
|
Future<HomeEntity> getData({required HomeParams params}); |
||||
|
} |
||||
|
|
||||
|
class HomeDatasourceImpl implements IHomeDatasource { |
||||
|
final IHttpRequest httpRequest; |
||||
|
|
||||
|
const HomeDatasourceImpl(this.httpRequest); |
||||
|
|
||||
|
@override |
||||
|
Future<HomeEntity> getData({required HomeParams params}) async { |
||||
|
final response = await httpRequest.get( |
||||
|
path: MyApi.baseUrl, |
||||
|
); |
||||
|
|
||||
|
return BaseResponse.getData<HomeEntity>( |
||||
|
response?['data'], |
||||
|
(json) => HomeModel.fromJson(json), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
import 'package:shia_game_flutter/features/home/domain/entity/home_entity.dart'; |
||||
|
|
||||
|
class HomeModel extends HomeEntity { |
||||
|
const HomeModel({ |
||||
|
super.id, |
||||
|
}); |
||||
|
|
||||
|
factory HomeModel.fromJson(Map<String, dynamic> json) { |
||||
|
return HomeModel( |
||||
|
id: json['id'], |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
import 'package:flutter/foundation.dart'; |
||||
|
import 'package:shia_game_flutter/core/error_handler/my_exception.dart'; |
||||
|
import 'package:shia_game_flutter/core/params/home_params.dart'; |
||||
|
import 'package:shia_game_flutter/core/utils/data_state.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/data/datasource/home_datasource.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/domain/entity/home_entity.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/domain/repository/home_repository.dart'; |
||||
|
|
||||
|
class HomeRepositoryImpl implements IHomeRepository { |
||||
|
final IHomeDatasource datasource; |
||||
|
|
||||
|
const HomeRepositoryImpl(this.datasource); |
||||
|
|
||||
|
@override |
||||
|
Future<DataState<HomeEntity, MyException>> getData({required HomeParams params}) async { |
||||
|
try { |
||||
|
final HomeEntity 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')); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
import 'package:equatable/equatable.dart'; |
||||
|
|
||||
|
class BottomNavEntity extends Equatable { |
||||
|
final String? icon; |
||||
|
final String? title; |
||||
|
|
||||
|
const BottomNavEntity({this.icon, this.title}); |
||||
|
|
||||
|
@override |
||||
|
List<Object?> get props => [icon, title]; |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
import 'package:equatable/equatable.dart'; |
||||
|
|
||||
|
class HomeEntity extends Equatable { |
||||
|
final int? id; |
||||
|
|
||||
|
const HomeEntity({ |
||||
|
this.id, |
||||
|
}); |
||||
|
|
||||
|
@override |
||||
|
List<Object?> get props => [ |
||||
|
id, |
||||
|
]; |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
import 'package:shia_game_flutter/core/error_handler/my_exception.dart'; |
||||
|
import 'package:shia_game_flutter/core/params/home_params.dart'; |
||||
|
import 'package:shia_game_flutter/core/utils/data_state.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/domain/entity/home_entity.dart'; |
||||
|
|
||||
|
abstract class IHomeRepository { |
||||
|
Future<DataState<HomeEntity, MyException>> getData({required HomeParams params}); |
||||
|
} |
||||
@ -0,0 +1,17 @@ |
|||||
|
import 'package:shia_game_flutter/core/error_handler/my_exception.dart'; |
||||
|
import 'package:shia_game_flutter/core/params/home_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/home/domain/entity/home_entity.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/domain/repository/home_repository.dart'; |
||||
|
|
||||
|
class GetHomeUseCase implements UseCase<HomeEntity, HomeParams> { |
||||
|
final IHomeRepository repository; |
||||
|
|
||||
|
const GetHomeUseCase(this.repository); |
||||
|
|
||||
|
@override |
||||
|
Future<DataState<HomeEntity, MyException>> call(HomeParams params) { |
||||
|
return repository.getData(params: params); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
import 'package:shia_game_flutter/features/home/presentation/controller/home_controller.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
|
||||
|
class HomeBinding extends Bindings { |
||||
|
@override |
||||
|
void dependencies() { |
||||
|
Get.put<HomeController>(HomeController(Get.find())); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,81 @@ |
|||||
|
import 'package:flutter/cupertino.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
import 'package:shia_game_flutter/common_ui/resources/my_assets.dart'; |
||||
|
import 'package:shia_game_flutter/core/params/home_params.dart'; |
||||
|
import 'package:shia_game_flutter/core/status/base_status.dart'; |
||||
|
import 'package:shia_game_flutter/core/utils/my_localization.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/domain/entity/bottom_nav_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'; |
||||
|
|
||||
|
class HomeController extends GetxController with StateMixin { |
||||
|
/// ----- Constructor ----- |
||||
|
HomeController(this.getHomeUseCase); |
||||
|
|
||||
|
@override |
||||
|
void onInit() { |
||||
|
super.onInit(); |
||||
|
change('', status: RxStatus.success()); |
||||
|
} |
||||
|
|
||||
|
@override |
||||
|
void onClose() { |
||||
|
textEditingController.dispose(); |
||||
|
super.onClose(); |
||||
|
} |
||||
|
|
||||
|
/// ----- UseCases ----- |
||||
|
final GetHomeUseCase getHomeUseCase; |
||||
|
|
||||
|
/// ----- Variables ----- |
||||
|
final Rx<HomeParams> homeParams = Rx(HomeParams()); |
||||
|
final Rx<HomeEntity> homeEntity = Rx(const HomeEntity()); |
||||
|
final List<BottomNavEntity> bottomNavList = [ |
||||
|
BottomNavEntity( |
||||
|
icon: MyAssets.iconHome, |
||||
|
title: Get.context?.translate.home, |
||||
|
), |
||||
|
BottomNavEntity( |
||||
|
icon: MyAssets.iconShop, |
||||
|
title: Get.context?.translate.shop, |
||||
|
), |
||||
|
BottomNavEntity( |
||||
|
icon: MyAssets.iconAwards, |
||||
|
title: Get.context?.translate.awards, |
||||
|
), |
||||
|
BottomNavEntity( |
||||
|
icon: MyAssets.iconProfile, |
||||
|
title: Get.context?.translate.profile, |
||||
|
), |
||||
|
]; |
||||
|
|
||||
|
final Rx<int> selectedIndex = Rx(0); |
||||
|
|
||||
|
|
||||
|
/// ------ Controllers ------ |
||||
|
final TextEditingController textEditingController = TextEditingController(); |
||||
|
|
||||
|
/// ------ Statuses ------ |
||||
|
final Rx<BaseStatus> getHomeStatus = Rx(const BaseInit()); |
||||
|
|
||||
|
/// ------ Functions ------ |
||||
|
void onChangeBottomNavBar(int index) { |
||||
|
selectedIndex.value = index; |
||||
|
} |
||||
|
|
||||
|
/// ------ Api Calls ------ |
||||
|
Future<void> getHome() async { |
||||
|
change('', status: RxStatus.loading()); |
||||
|
await getHomeUseCase(homeParams.value).then( |
||||
|
(value) => value.fold( |
||||
|
(data) { |
||||
|
homeEntity.value = data; |
||||
|
change('', status: RxStatus.success()); |
||||
|
}, |
||||
|
(error) { |
||||
|
change('', status: RxStatus.error(error.errorMessage)); |
||||
|
}, |
||||
|
), |
||||
|
); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
import 'package:flutter/material.dart'; |
||||
|
import 'package:get/get.dart'; |
||||
|
import 'package:shia_game_flutter/features/home/presentation/controller/home_controller.dart'; |
||||
|
import 'package:shia_game_flutter/core/widgets/bottom_nav_bar/bottom_nav_bar.dart'; |
||||
|
|
||||
|
class HomePage extends GetView<HomeController> { |
||||
|
const HomePage({super.key}); |
||||
|
|
||||
|
@override |
||||
|
Widget build(BuildContext context) { |
||||
|
return Scaffold(bottomNavigationBar: BottomNavBar()); |
||||
|
} |
||||
|
} |
||||
@ -1,4 +1,8 @@ |
|||||
{ |
{ |
||||
"@@locale": "en", |
"@@locale": "en", |
||||
"loading": "Loading..." |
|
||||
|
"loading": "Loading...", |
||||
|
"home": "Home", |
||||
|
"shop": "Shop", |
||||
|
"awards": "Awards", |
||||
|
"profile": "Profile" |
||||
} |
} |
||||
Write
Preview
Loading…
Cancel
Save
Reference in new issue