Browse Source

切换国家的部分逻辑

liukai 7 months ago
parent
commit
bad614e189

+ 6 - 0
packages/cpt_auth/lib/modules/login/login_controller.dart

@@ -1,5 +1,6 @@
 import 'package:cpt_auth/modules/main/main_page.dart';
 import 'package:cpt_auth/modules/reset_psd/reset_psd_page.dart';
+import 'package:cpt_auth/modules/select_country/select_country_page.dart';
 import 'package:domain/entity/response/hotel_info_entity.dart';
 import 'package:domain/repository/auth_repository.dart';
 import 'package:get/get.dart';
@@ -92,4 +93,9 @@ class LoginController extends GetxController with DioCancelableMixin {
   void gotoSignUpPage() {
     SignUpPage.startInstance();
   }
+
+  // 去切换国家的页面
+  void gotoSelectCountryPage() {
+    SelectCountryPage.startInstance();
+  }
 }

+ 18 - 8
packages/cpt_auth/lib/modules/login/login_page.dart

@@ -93,14 +93,24 @@ class _MainPageState extends BaseState<LoginPage, LoginController> with StateLif
                 //当前选择的国家,这个不跟随滚动
                 Align(
                   alignment: Alignment.topRight,
-                  child: MyTextView(
-                    "Vietnam".tr,
-                    textColor: ColorConstants.white,
-                    isFontMedium: true,
-                    fontSize: 15,
-                    marginTop: ScreenUtil.getStatusBarH(context) + 20,
-                    marginRight: 20,
-                  ),
+                  child: Row(
+                    mainAxisSize: MainAxisSize.min,
+                    crossAxisAlignment: CrossAxisAlignment.center,
+                    children: [
+                      MyTextView(
+                        "Vietnam".tr,
+                        textColor: ColorConstants.white,
+                        isFontMedium: true,
+                        marginRight: 5,
+                        fontSize: 15,
+                      ),
+                      MyAssetImage(
+                        Assets.baseServiceTriangleDropDown,
+                        width: 8,
+                        height: 5,
+                      ),
+                    ],
+                  ).onTap(() => controller.gotoSelectCountryPage()).marginOnly(right: 20, top: ScreenUtil.getStatusBarH(context) + 20),
                 ),
 
                 // 底部滚动的布局

+ 7 - 0
packages/cpt_auth/lib/modules/select_country/select_country_controller.dart

@@ -0,0 +1,7 @@
+import 'package:get/get.dart';
+
+import 'select_country_state.dart';
+
+class SelectCountryController extends GetxController {
+  final SelectCountryState state = SelectCountryState();
+}

+ 191 - 0
packages/cpt_auth/lib/modules/select_country/select_country_page.dart

@@ -0,0 +1,191 @@
+import 'package:cpt_auth/modules/select_country/select_country_state.dart';
+import 'package:cs_resources/constants/color_constants.dart';
+import 'package:cs_resources/generated/assets.dart';
+import 'package:flutter/cupertino.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter/widgets.dart';
+import 'package:get/get.dart';
+import 'package:plugin_basic/base/base_stateless_page.dart';
+import 'package:plugin_basic/utils/ext_get_nav.dart';
+import 'package:router/path/router_path.dart';
+import 'package:shared/utils/screen_util.dart';
+import 'package:widgets/ext/ex_widget.dart';
+import 'package:widgets/my_button.dart';
+import 'package:widgets/my_load_image.dart';
+import 'package:widgets/my_text_view.dart';
+
+import 'select_country_controller.dart';
+
+class SelectCountryPage extends BaseStatelessPage<SelectCountryController> {
+  SelectCountryPage({Key? key}) : super(key: key);
+
+  //启动当前页面
+  static void startInstance() {
+    return Get.start(RouterPath.AUTH_SELECT_COUNTRY);
+  }
+
+  late SelectCountryState state;
+
+  @override
+  void initState() {
+    state = controller.state;
+  }
+
+  @override
+  SelectCountryController createRawController() {
+    return SelectCountryController();
+  }
+
+  @override
+  Widget buildWidget(BuildContext context) {
+    return Scaffold(
+      body: SafeArea(
+        bottom: true,
+        top: false,
+        child: Container(
+          width: double.infinity,
+          height: double.infinity,
+          padding: EdgeInsets.only(top: ScreenUtil.getStatusBarH(context)),
+          decoration: const BoxDecoration(
+            gradient: LinearGradient(
+              colors: [
+                Color(0xFF091D44),
+                Color(0xFF245A8A),
+                Color(0xFF7F7CEC),
+              ],
+              begin: Alignment.topCenter,
+              end: Alignment.bottomCenter,
+            ),
+          ),
+          child: Column(
+            mainAxisSize: MainAxisSize.max,
+            crossAxisAlignment: CrossAxisAlignment.center,
+            children: [
+              // 底部滚动的布局
+              SingleChildScrollView(
+                  scrollDirection: Axis.vertical,
+                  physics: const BouncingScrollPhysics(),
+                  child: Column(
+                    mainAxisSize: MainAxisSize.max,
+                    crossAxisAlignment: CrossAxisAlignment.center,
+                    children: [
+                      MyTextView(
+                        "Casual Labour System",
+                        textColor: ColorConstants.white,
+                        isFontBold: true,
+                        fontSize: 35,
+                        marginTop: 20,
+                        fontStyle: FontStyle.italic,
+                        textAlign: TextAlign.center,
+                        marginLeft: 50,
+                        marginRight: 50,
+                      ),
+                      MyTextView(
+                        "Select Country".tr,
+                        textColor: ColorConstants.white,
+                        isFontMedium: true,
+                        fontSize: 21,
+                        marginTop: 18,
+                      ),
+                      MyTextView(
+                        "Browse jobs available in your selected country.".tr,
+                        textColor: ColorConstants.white,
+                        isFontMedium: true,
+                        fontSize: 14,
+                        marginTop: 9,
+                      ),
+
+                      //新加坡的选项
+                      Container(
+                        width: double.infinity,
+                        margin: EdgeInsets.only(top: 48, left: 20, right: 20),
+                        padding: EdgeInsets.symmetric(vertical: 13, horizontal: 17),
+                        decoration: BoxDecoration(
+                          color: Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
+                          borderRadius: BorderRadius.circular(5.0), // 设置圆角
+                        ),
+                        child: Row(
+                          children: [
+                            MyAssetImage(Assets.cptAuthSgIcon, width: 50, height: 33),
+                            MyTextView(
+                              "Singapore".tr,
+                              marginLeft: 17,
+                              textColor: ColorConstants.white,
+                              isFontMedium: true,
+                              fontSize: 18,
+                            ).expanded(),
+                            Obx(() {
+                              return Visibility(
+                                visible: state.curSelectCountry.value == 1,
+                                child: MyAssetImage(Assets.cptAuthCheckedIcon, width: 22, height: 22),
+                              );
+                            }),
+                          ],
+                        ),
+                      ).onTap(() {
+                        state.curSelectCountry.value = 1;
+                      }),
+
+                      //越南的选项
+                      Container(
+                        width: double.infinity,
+                        margin: EdgeInsets.only(top: 13.5, left: 20, right: 20),
+                        padding: EdgeInsets.symmetric(vertical: 13, horizontal: 17),
+                        decoration: BoxDecoration(
+                          color: Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
+                          borderRadius: BorderRadius.circular(5.0), // 设置圆角
+                        ),
+                        child: Row(
+                          children: [
+                            MyAssetImage(Assets.cptAuthVnIcon, width: 50, height: 33),
+                            MyTextView(
+                              "Vietnam".tr,
+                              marginLeft: 17,
+                              textColor: ColorConstants.white,
+                              isFontMedium: true,
+                              fontSize: 18,
+                            ).expanded(),
+                            Obx(() {
+                              return Visibility(
+                                visible: state.curSelectCountry.value == 0,
+                                child: MyAssetImage(Assets.cptAuthCheckedIcon, width: 22, height: 22),
+                              );
+                            }),
+                          ],
+                        ),
+                      ).onTap(() {
+                        state.curSelectCountry.value = 0;
+                      }),
+
+                      //Next按钮
+                      Stack(
+                        children: [
+                          MyButton(
+                            type: ClickType.throttle,
+                            milliseconds: 500,
+                            onPressed: () {},
+                            text: "Next".tr,
+                            textColor: ColorConstants.white,
+                            fontSize: 18,
+                            minHeight: 50,
+                            radius: 22.5,
+                            backgroundColor: hexToColor("#FFBB1B"),
+                            fontWeight: FontWeight.w500,
+                          ),
+                          Positioned(
+                            right: 28,
+                            top: 0,
+                            bottom: 0,
+                            child: MyAssetImage(Assets.cptAuthNextIcon, width: 20, height: 14.5),
+                          ),
+                        ],
+                      ).marginSymmetric(horizontal: 20, vertical: 36)
+                    ],
+                  )).expanded(),
+            ],
+          ),
+        ),
+      ),
+    );
+  }
+}

+ 7 - 0
packages/cpt_auth/lib/modules/select_country/select_country_state.dart

@@ -0,0 +1,7 @@
+import 'package:plugin_basic/basic_export.dart';
+
+class SelectCountryState {
+
+  RxInt curSelectCountry = 0.obs;
+
+}

+ 7 - 1
packages/cpt_auth/lib/router/page_router.dart

@@ -7,6 +7,7 @@ import 'package:router/path/router_path.dart';
 import '../modules/login/login_page.dart';
 import '../modules/main/main_page.dart';
 import '../modules/reset_psd/reset_psd_page.dart';
+import '../modules/select_country/select_country_page.dart';
 
 class AuthPageRouter {
   static final routes = [
@@ -34,11 +35,16 @@ class AuthPageRouter {
       page: () => ResetPasswordPage(),
     ),
 
-    //重置密码
+    //设置
     GetPage(
       name: RouterPath.SETTINGS,
       page: () => SettingPage(),
     ),
 
+    //切换国家
+    GetPage(
+      name: RouterPath.AUTH_SELECT_COUNTRY,
+      page: () => SelectCountryPage(),
+    ),
   ];
 }

+ 3 - 6
packages/cs_plugin_basic/lib/constants/app_constant.dart

@@ -7,6 +7,8 @@ class AppConstant {
   /// App运行在Release环境时,inProduction为true;当App运行在Debug和Profile环境时,inProduction为false
   static const bool inProduction = kReleaseMode; //本地打包的编译环境是 Debug 还是 Release (自动生成,不需手动修改)
 
+  static int selectCountry = 0;  //当前选中的国家,默认越南   0越南  1新加坡  2马来西亚
+
   static const String theme = 'AppTheme';
   static const String locale = 'locale';
 
@@ -14,9 +16,9 @@ class AppConstant {
   static const storageGuideFirst = 'guide_first'; //是否经历过Guide
   static const storageToken = 'token'; //用户的Token
   static const storageIsAdmin = 'is_admin'; //登录选项是签到签出还是管理员登录(是否展示全功能) 0是签到签出 , 1是管理员
-  static const searchJobHistoryRecord = 'search_job_history_record'; //兼职工作搜索记录
   static const storageNotificationEnable = 'storage_notification_enable'; //应用设置的推送是否开启
   static const storageDeviceUUID = 'storage_device_uuid'; //设备的UUID
+  static const storageSelectedCountry = 'storage_select_country'; //当前选中的国家
 
   //消息通知Key
   static const eventProfile2Refresh = 'event_profile_refresh'; //通知用户信息需要刷新
@@ -24,9 +26,4 @@ class AppConstant {
   static const eventAppliedListRefresh = 'event_applied_list_refresh'; //已申请的列表刷新
 
 
-  // navbar 导航栏高度
-  static const double navBarHeight = kToolbarHeight;
-
-  // tabbar  高度 (pt)
-  static const double tabBarHeight = 44;
 }

BIN
packages/cs_resources/assets/base_service/triangle_drop_down.webp


BIN
packages/cs_resources/assets/cpt_auth/checked_icon.webp


BIN
packages/cs_resources/assets/cpt_auth/next_icon.webp


BIN
packages/cs_resources/assets/cpt_auth/sg_icon.webp


BIN
packages/cs_resources/assets/cpt_auth/vn_icon.webp


+ 5 - 0
packages/cs_resources/lib/generated/assets.dart

@@ -17,11 +17,16 @@ class Assets {
   static const String baseServiceRatingSelected = 'assets/base_service/rating_selected.webp';
   static const String baseServiceRatingUnselected = 'assets/base_service/rating_unselected.webp';
   static const String baseServiceTitleBarFilterIcon = 'assets/base_service/title_bar_filter_icon.webp';
+  static const String baseServiceTriangleDropDown = 'assets/base_service/triangle_drop_down.webp';
   static const String baseServiceTriangleDropDownIcon = 'assets/base_service/triangle_drop_down_icon.webp';
+  static const String cptAuthCheckedIcon = 'assets/cpt_auth/checked_icon.webp';
   static const String cptAuthLoginRadioChecked = 'assets/cpt_auth/login_radio_checked.webp';
   static const String cptAuthLoginRadioUncheck = 'assets/cpt_auth/login_radio_uncheck.webp';
+  static const String cptAuthNextIcon = 'assets/cpt_auth/next_icon.webp';
   static const String cptAuthPasswordHideIcon = 'assets/cpt_auth/password_hide_icon.webp';
   static const String cptAuthPasswordShowIcon = 'assets/cpt_auth/password_show_icon.webp';
+  static const String cptAuthSgIcon = 'assets/cpt_auth/sg_icon.webp';
+  static const String cptAuthVnIcon = 'assets/cpt_auth/vn_icon.webp';
   static const String cptJobArrawDownIcon = 'assets/cpt_job/arraw_down_icon.webp';
   static const String cptJobArrawUpIcon = 'assets/cpt_job/arraw_up_icon.webp';
   static const String cptJobExportIcon = 'assets/cpt_job/export_icon.webp';

+ 2 - 0
packages/cs_resources/lib/local/language/en_US.dart

@@ -139,6 +139,8 @@ const Map<String, String> en_US = {
   'Others': 'Others',
   'Staff Detail': 'Staff Detail',
   'Staff Name/ID/Phone': 'Staff Name/ID/Phone',
+  'Select Country': 'Select Country',
+  'Browse jobs available in your selected country.': 'Browse jobs available in your selected country.',
 
   //插件的国际化
   'Pull to refresh': 'Pull to refresh',

+ 2 - 0
packages/cs_resources/lib/local/language/vi_VN.dart

@@ -139,6 +139,8 @@ const Map<String, String> vi_VN = {
   "Others": "Những cái khác",
   "Staff Detail": "Chi tiết nhân viên",
   'Staff Name/ID/Phone': 'Tên nhân viên/ID/Số điện thoại',
+  'Select Country': 'Chọn quốc gia',
+  'Browse jobs available in your selected country.': 'Duyệt các công việc có sẵn ở quốc gia đã chọn',
 
   //插件的国际化
   "Pull to refresh": "Kéo để làm mới",

+ 2 - 0
packages/cs_resources/lib/local/language/zh_CN.dart

@@ -139,6 +139,8 @@ const Map<String, String> zh_CN = {
   'Others': '其他',
   'Staff Detail': '员工详情',
   'Staff Name/ID/Phone': '员工姓名/ID/电话号码',
+  'Select Country': '选择国家',
+  'Browse jobs available in your selected country.': '浏览所选国家/地区的可用工作',
 
   //插件的国际化
   'Pull to refresh': '下拉刷新',

+ 1 - 0
packages/cs_router/lib/path/router_path.dart

@@ -8,6 +8,7 @@ class RouterPath {
   static const AUTH_LOGIN = '/auth/login'; //用户登录注册
   static const AUTH_SIGNUP = '/auth/signup'; //注册
   static const AUTH_RESET_PSD = '/auth/rest_psd'; //重置密码
+  static const AUTH_SELECT_COUNTRY = '/auth/select/country'; //切换国家
 
   //首页
   static const MAIN = '/main';