select_country_page.dart 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. import 'package:cs_resources/constants/color_constants.dart';
  2. import 'package:cs_resources/generated/assets.dart';
  3. import 'package:flutter/cupertino.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:flutter/widgets.dart';
  6. import 'package:get/get.dart';
  7. import 'package:plugin_basic/base/base_stateless_page.dart';
  8. import 'package:plugin_basic/service/app_config_service.dart';
  9. import 'package:plugin_basic/utils/ext_get_nav.dart';
  10. import 'package:router/path/router_path.dart';
  11. import 'package:shared/utils/screen_util.dart';
  12. import 'package:widgets/ext/ex_widget.dart';
  13. import 'package:widgets/my_button.dart';
  14. import 'package:widgets/my_load_image.dart';
  15. import 'package:widgets/my_text_view.dart';
  16. import 'select_country_controller.dart';
  17. class SelectCountryPage extends BaseStatelessPage<SelectCountryController> {
  18. SelectCountryPage({Key? key}) : super(key: key);
  19. //启动当前页面
  20. static void startInstance() {
  21. return Get.start(RouterPath.authSelectCountry);
  22. }
  23. @override
  24. void initState() {}
  25. @override
  26. SelectCountryController createRawController() {
  27. return SelectCountryController();
  28. }
  29. @override
  30. Widget buildWidget(BuildContext context) {
  31. return Scaffold(
  32. body: SafeArea(
  33. bottom: MediaQuery.of(context).padding.bottom > 38,
  34. top: false,
  35. child: Container(
  36. width: double.infinity,
  37. height: double.infinity,
  38. padding: EdgeInsets.only(top: ScreenUtil.getStatusBarH(context)),
  39. decoration: const BoxDecoration(
  40. gradient: LinearGradient(
  41. colors: [
  42. Color(0xFF091D44),
  43. Color(0xFF245A8A),
  44. Color(0xFF7F7CEC),
  45. ],
  46. begin: Alignment.topCenter,
  47. end: Alignment.bottomCenter,
  48. ),
  49. ),
  50. child: Column(
  51. mainAxisSize: MainAxisSize.max,
  52. crossAxisAlignment: CrossAxisAlignment.center,
  53. children: [
  54. // 底部滚动的布局
  55. SingleChildScrollView(
  56. scrollDirection: Axis.vertical,
  57. physics: const BouncingScrollPhysics(),
  58. child: Column(
  59. mainAxisSize: MainAxisSize.max,
  60. crossAxisAlignment: CrossAxisAlignment.center,
  61. children: [
  62. MyTextView(
  63. "Casual Labour System",
  64. textColor: ColorConstants.white,
  65. isFontBold: true,
  66. fontSize: 35,
  67. marginTop: 20,
  68. fontStyle: FontStyle.italic,
  69. textAlign: TextAlign.center,
  70. marginLeft: 50,
  71. marginRight: 50,
  72. ),
  73. MyTextView(
  74. "Select Country".tr,
  75. textColor: ColorConstants.white,
  76. isFontMedium: true,
  77. fontSize: 21,
  78. marginTop: 18,
  79. ),
  80. MyTextView(
  81. "Browse jobs available in your selected country.".tr,
  82. textColor: ColorConstants.white,
  83. isFontMedium: true,
  84. fontSize: 14,
  85. marginTop: 9,
  86. ),
  87. //新加坡的选项
  88. Container(
  89. width: double.infinity,
  90. margin: const EdgeInsets.only(top: 48, left: 20, right: 20),
  91. padding: const EdgeInsets.symmetric(vertical: 13, horizontal: 17),
  92. decoration: BoxDecoration(
  93. color: const Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
  94. borderRadius: BorderRadius.circular(5.0), // 设置圆角
  95. ),
  96. child: Row(
  97. children: [
  98. const MyAssetImage(Assets.cptAuthSgIcon, width: 50, height: 33),
  99. MyTextView(
  100. "Singapore".tr,
  101. marginLeft: 17,
  102. textColor: ColorConstants.white,
  103. isFontMedium: true,
  104. fontSize: 18,
  105. ).expanded(),
  106. Obx(() {
  107. return Visibility(
  108. visible: ConfigService.to.selectCountry.value == 1,
  109. child: const MyAssetImage(Assets.cptAuthCheckedIcon, width: 22, height: 22),
  110. );
  111. }),
  112. ],
  113. ),
  114. ).onTap(() {
  115. ConfigService.to.selectCountry.value = 1;
  116. }),
  117. //英国的选项
  118. Container(
  119. width: double.infinity,
  120. margin: const EdgeInsets.only(top: 13.5, left: 20, right: 20),
  121. padding: const EdgeInsets.symmetric(vertical: 13, horizontal: 17),
  122. decoration: BoxDecoration(
  123. color: const Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
  124. borderRadius: BorderRadius.circular(5.0), // 设置圆角
  125. ),
  126. child: Row(
  127. children: [
  128. const MyAssetImage(Assets.cptAuthUkIcon, width: 50, height: 33),
  129. MyTextView(
  130. "United Kingdom".tr,
  131. marginLeft: 17,
  132. textColor: ColorConstants.white,
  133. isFontMedium: true,
  134. fontSize: 18,
  135. ).expanded(),
  136. Obx(() {
  137. return Visibility(
  138. visible: ConfigService.to.selectCountry.value == 2,
  139. child: const MyAssetImage(Assets.cptAuthCheckedIcon, width: 22, height: 22),
  140. );
  141. }),
  142. ],
  143. ),
  144. ).onTap(() {
  145. ConfigService.to.selectCountry.value = 2;
  146. }),
  147. //马来西亚
  148. Container(
  149. width: double.infinity,
  150. margin: const EdgeInsets.only(top: 13.5, left: 20, right: 20),
  151. padding: const EdgeInsets.symmetric(vertical: 13, horizontal: 17),
  152. decoration: BoxDecoration(
  153. color: const Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
  154. borderRadius: BorderRadius.circular(5.0), // 设置圆角
  155. ),
  156. child: Row(
  157. children: [
  158. const MyAssetImage(Assets.cptAuthMsIcon, width: 50, height: 33),
  159. MyTextView(
  160. "Malaysia".tr,
  161. marginLeft: 17,
  162. textColor: ColorConstants.white,
  163. isFontMedium: true,
  164. fontSize: 18,
  165. ).expanded(),
  166. Obx(() {
  167. return Visibility(
  168. visible: ConfigService.to.selectCountry.value == 3,
  169. child: const MyAssetImage(Assets.cptAuthCheckedIcon, width: 22, height: 22),
  170. );
  171. }),
  172. ],
  173. ),
  174. ).onTap(() {
  175. ConfigService.to.selectCountry.value = 3;
  176. }),
  177. //泰国
  178. Container(
  179. width: double.infinity,
  180. margin: const EdgeInsets.only(top: 13.5, left: 20, right: 20),
  181. padding: const EdgeInsets.symmetric(vertical: 13, horizontal: 17),
  182. decoration: BoxDecoration(
  183. color: const Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
  184. borderRadius: BorderRadius.circular(5.0), // 设置圆角
  185. ),
  186. child: Row(
  187. children: [
  188. const MyAssetImage(Assets.cptAuthThIcon, width: 50, height: 33),
  189. MyTextView(
  190. "thailand".tr,
  191. marginLeft: 17,
  192. textColor: ColorConstants.white,
  193. isFontMedium: true,
  194. fontSize: 18,
  195. ).expanded(),
  196. Obx(() {
  197. return Visibility(
  198. visible: ConfigService.to.selectCountry.value == 5,
  199. child: const MyAssetImage(Assets.cptAuthCheckedIcon, width: 22, height: 22),
  200. );
  201. }),
  202. ],
  203. ),
  204. ).onTap(() {
  205. ConfigService.to.selectCountry.value = 5;
  206. }),
  207. //荷兰
  208. Container(
  209. width: double.infinity,
  210. margin: const EdgeInsets.only(top: 13.5, left: 20, right: 20),
  211. padding: const EdgeInsets.symmetric(vertical: 13, horizontal: 17),
  212. decoration: BoxDecoration(
  213. color: const Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
  214. borderRadius: BorderRadius.circular(5.0), // 设置圆角
  215. ),
  216. child: Row(
  217. children: [
  218. const MyAssetImage(Assets.cptAuthNlIcon, width: 50, height: 33),
  219. MyTextView(
  220. "Netherlands".tr,
  221. marginLeft: 17,
  222. textColor: ColorConstants.white,
  223. isFontMedium: true,
  224. fontSize: 18,
  225. ).expanded(),
  226. Obx(() {
  227. return Visibility(
  228. visible: ConfigService.to.selectCountry.value == 4,
  229. child: const MyAssetImage(Assets.cptAuthCheckedIcon, width: 22, height: 22),
  230. );
  231. }),
  232. ],
  233. ),
  234. ).onTap(() {
  235. ConfigService.to.selectCountry.value = 4;
  236. }),
  237. //越南
  238. // Container(
  239. // width: double.infinity,
  240. // margin: const EdgeInsets.only(top: 13.5, left: 20, right: 20),
  241. // padding: const EdgeInsets.symmetric(vertical: 13, horizontal: 17),
  242. // decoration: BoxDecoration(
  243. // color: const Color(0xFF4DCFF6).withOpacity(0.2), // 设置背景颜色和不透明度
  244. // borderRadius: BorderRadius.circular(5.0), // 设置圆角
  245. // ),
  246. // child: Row(
  247. // children: [
  248. // const MyAssetImage(Assets.cptAuthVnIcon, width: 50, height: 33),
  249. // MyTextView(
  250. // "Vietnam".tr,
  251. // marginLeft: 17,
  252. // textColor: ColorConstants.white,
  253. // isFontMedium: true,
  254. // fontSize: 18,
  255. // ).expanded(),
  256. // Obx(() {
  257. // return Visibility(
  258. // visible: ConfigService.to.selectCountry.value == 0,
  259. // child: const MyAssetImage(Assets.cptAuthCheckedIcon, width: 22, height: 22),
  260. // );
  261. // }),
  262. // ],
  263. // ),
  264. // ).onTap(() {
  265. // ConfigService.to.selectCountry.value = 0;
  266. // }),
  267. //Next按钮
  268. Stack(
  269. children: [
  270. MyButton(
  271. type: ClickType.throttle,
  272. milliseconds: 500,
  273. onPressed: () {
  274. controller.setupNext();
  275. },
  276. text: "Next".tr,
  277. textColor: ColorConstants.white,
  278. fontSize: 18,
  279. minHeight: 50,
  280. radius: 22.5,
  281. backgroundColor: hexToColor("#FFBB1B"),
  282. fontWeight: FontWeight.w500,
  283. ),
  284. const Positioned(
  285. right: 28,
  286. top: 0,
  287. bottom: 0,
  288. child: MyAssetImage(Assets.cptAuthNextIcon, width: 20, height: 14.5),
  289. ),
  290. ],
  291. ).marginSymmetric(horizontal: 20, vertical: 36)
  292. ],
  293. )).expanded(),
  294. ],
  295. ),
  296. ),
  297. ),
  298. );
  299. }
  300. }