login_dialog_view.dart 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. import 'package:flutter/src/widgets/framework.dart';
  2. import 'package:flutter_screenutil/flutter_screenutil.dart';
  3. import 'package:keyboard/base/base_view.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:keyboard/module/login/login_controller.dart';
  6. import 'package:keyboard/dialog/login/login_dialog_controller.dart';
  7. import 'package:get/get.dart';
  8. import '../../data/consts/web_url.dart';
  9. import '../../resource/assets.gen.dart';
  10. import '../../resource/string.gen.dart';
  11. import '../../widget/click_text_span.dart';
  12. class LoginDialogView extends BaseView<LoginDialogController> {
  13. const LoginDialogView({super.key});
  14. static var TAG = "LoginDialog";
  15. @override
  16. backgroundColor() => Colors.transparent;
  17. @override
  18. Widget buildBody(BuildContext context) {
  19. return Container(
  20. decoration: BoxDecoration(
  21. color: Colors.white,
  22. borderRadius: BorderRadius.only(
  23. topLeft: Radius.circular(24.r),
  24. topRight: Radius.circular(24.r),
  25. ),
  26. ),
  27. child: Column(
  28. mainAxisSize: MainAxisSize.min,
  29. crossAxisAlignment: CrossAxisAlignment.center,
  30. children: [
  31. Stack(
  32. children: [
  33. Container(
  34. width: 360.w,
  35. decoration: BoxDecoration(
  36. image: DecorationImage(
  37. image: Assets.images.bgLoginDialog.provider(),
  38. fit: BoxFit.contain,
  39. alignment: Alignment.topCenter,
  40. ),
  41. ),
  42. child: Container(
  43. child: Column(
  44. children: [
  45. SizedBox(height: 131.h),
  46. _buildWeChatButton(),
  47. SizedBox(height: 12.h),
  48. _buildAppleButton(),
  49. SizedBox(height: 31.h),
  50. _buildPhoneLoginButton(),
  51. SizedBox(height: 10.h),
  52. _buildPrivacy(),
  53. ],
  54. ),
  55. ),
  56. ),
  57. Positioned(
  58. right: 13.w,
  59. top: 13.w,
  60. child: InkWell(onTap: controller.clickClose,
  61. child: Assets.images.iconLoginDialogClose.image(
  62. width: 24.w,
  63. height: 24.w,
  64. ),)
  65. ),
  66. ],
  67. ),
  68. ],
  69. ),
  70. );
  71. }
  72. Widget _buildPhoneLoginButton() {
  73. return InkWell(
  74. onTap: () {
  75. controller.clickPhoneLogin();
  76. },
  77. child: Column(
  78. children: [
  79. Container(
  80. width: 44.w,
  81. height: 44.w,
  82. decoration: ShapeDecoration(
  83. color: const Color(0xFFF5F4F9),
  84. shape: OvalBorder(),
  85. ),
  86. child: Center(
  87. child: Assets.images.iconLoginDialogPhoneLogo.image(
  88. width: 20.w,
  89. height: 20.w,
  90. ),
  91. ),
  92. ),
  93. Text(
  94. '手机号登录',
  95. textAlign: TextAlign.center,
  96. style: TextStyle(
  97. color: Colors.black.withValues(alpha: 128),
  98. fontSize: 12,
  99. fontFamily: 'Source Han Sans CN',
  100. fontWeight: FontWeight.w400,
  101. ),
  102. ),
  103. ],
  104. ),
  105. );
  106. }
  107. Widget _buildWeChatButton() {
  108. return InkWell(
  109. onTap: () {
  110. controller.clickWxLogin();
  111. },
  112. child: Container(
  113. width: 312.w,
  114. height: 48.h,
  115. decoration: ShapeDecoration(
  116. color: const Color(0xFF32DB78),
  117. shape: RoundedRectangleBorder(
  118. borderRadius: BorderRadius.circular(50.r),
  119. ),
  120. ),
  121. child: Row(
  122. mainAxisSize: MainAxisSize.min,
  123. mainAxisAlignment: MainAxisAlignment.center,
  124. crossAxisAlignment: CrossAxisAlignment.center,
  125. spacing: 4,
  126. children: [
  127. Assets.images.iconLoginDialogWechatLogoWhite.image(
  128. width: 26.w,
  129. height: 26.w,
  130. ),
  131. Text(
  132. StringName.wechatLogin,
  133. textAlign: TextAlign.center,
  134. style: TextStyle(
  135. color: Colors.white,
  136. fontSize: 16.sp,
  137. fontWeight: FontWeight.w500,
  138. ),
  139. ),
  140. ],
  141. ),
  142. ),
  143. );
  144. }
  145. Widget _buildAppleButton() {
  146. return InkWell(
  147. onTap: () {
  148. controller.clickAppleLogin();
  149. },
  150. child: Container(
  151. width: 312.w,
  152. height: 48.h,
  153. decoration: ShapeDecoration(
  154. color: const Color(0xFFF0F1F3),
  155. shape: RoundedRectangleBorder(
  156. borderRadius: BorderRadius.circular(50.r),
  157. ),
  158. ),
  159. child: Row(
  160. mainAxisSize: MainAxisSize.min,
  161. mainAxisAlignment: MainAxisAlignment.center,
  162. crossAxisAlignment: CrossAxisAlignment.center,
  163. spacing: 4,
  164. children: [
  165. Assets.images.iconLoginDialogApple.image(
  166. width: 14.w,
  167. height: 14.w,
  168. ),
  169. Text(
  170. StringName.useAppleLogin,
  171. textAlign: TextAlign.center,
  172. style: TextStyle(
  173. color: Color(0xFF000000).withAlpha(204),
  174. fontSize: 16.sp,
  175. fontWeight: FontWeight.w500,
  176. ),
  177. ),
  178. ],
  179. ),
  180. ),
  181. );
  182. }
  183. Widget _buildPrivacy() {
  184. return Row(
  185. mainAxisAlignment: MainAxisAlignment.center,
  186. children: [
  187. Obx(() {
  188. return GestureDetector(
  189. behavior: HitTestBehavior.opaque,
  190. onTap: () {
  191. controller.clickAgree();
  192. },
  193. child: Padding(
  194. padding: EdgeInsets.symmetric(vertical: 20.w,horizontal: 20.w),
  195. child:
  196. controller.isAgree
  197. ? Assets.images.iconLoginAgreePrivacy.image(
  198. width: 12.w,
  199. height: 12.w,
  200. )
  201. : Container(
  202. padding: EdgeInsets.all(1.w),
  203. width: 12.w,
  204. height: 12.w,
  205. child: Container(
  206. decoration: BoxDecoration(
  207. shape: BoxShape.circle,
  208. border: Border.all(
  209. color: Colors.black.withAlpha(153),
  210. width: 1.w,
  211. ),
  212. ),
  213. ),
  214. ),
  215. ),
  216. );
  217. }),
  218. Transform.translate(offset: Offset(-15.w,0),child: Text.rich(
  219. TextSpan(
  220. children: [
  221. TextSpan(
  222. text: StringName.textSpanIHaveReadAndAgree,
  223. style: TextStyle(
  224. color: Colors.black.withAlpha(128),
  225. fontSize: 12.sp,
  226. fontWeight: FontWeight.w400,
  227. ),
  228. ),
  229. ClickTextSpan(
  230. text: StringName.textSpanPrivacyPolicy,
  231. url: WebUrl.privacyPolicy,
  232. fontSize: 12.sp,
  233. color: Colors.black.withAlpha(204),
  234. ),
  235. TextSpan(
  236. text: StringName.textSpanAnd,
  237. style: TextStyle(
  238. color: Colors.black.withAlpha(128),
  239. fontSize: 12.sp,
  240. fontWeight: FontWeight.w400,
  241. ),
  242. ),
  243. ClickTextSpan(
  244. text: StringName.textSpanServiceTerms,
  245. url: WebUrl.serviceAgreement,
  246. color: Colors.black.withAlpha(204),
  247. fontSize: 12.sp,
  248. ),
  249. ],
  250. ),
  251. ),),
  252. ],
  253. );
  254. }
  255. }