login_dialog_view.dart 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  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: 31.h),
  48. _buildPhoneLoginButton(),
  49. SizedBox(height: 10.h),
  50. _buildPrivacy(),
  51. ],
  52. ),
  53. ),
  54. ),
  55. Positioned(
  56. right: 13.w,
  57. top: 13.w,
  58. child: InkWell(onTap: controller.clickClose,
  59. child: Assets.images.iconLoginDialogClose.image(
  60. width: 24.w,
  61. height: 24.w,
  62. ),)
  63. ),
  64. ],
  65. ),
  66. ],
  67. ),
  68. );
  69. }
  70. Widget _buildPhoneLoginButton() {
  71. return InkWell(
  72. onTap: () {
  73. controller.clickPhoneLogin();
  74. },
  75. child: Column(
  76. children: [
  77. Container(
  78. width: 44.w,
  79. height: 44.w,
  80. decoration: ShapeDecoration(
  81. color: const Color(0xFFF5F4F9),
  82. shape: OvalBorder(),
  83. ),
  84. child: Center(
  85. child: Assets.images.iconLoginDialogPhoneLogo.image(
  86. width: 20.w,
  87. height: 20.w,
  88. ),
  89. ),
  90. ),
  91. Text(
  92. '手机号登录',
  93. textAlign: TextAlign.center,
  94. style: TextStyle(
  95. color: Colors.black.withValues(alpha: 128),
  96. fontSize: 12,
  97. fontFamily: 'Source Han Sans CN',
  98. fontWeight: FontWeight.w400,
  99. ),
  100. ),
  101. ],
  102. ),
  103. );
  104. }
  105. Widget _buildWeChatButton() {
  106. return InkWell(
  107. onTap: () {
  108. controller.clickWxLogin();
  109. },
  110. child: Container(
  111. width: 312.w,
  112. height: 48.h,
  113. decoration: ShapeDecoration(
  114. color: const Color(0xFF31DB78),
  115. shape: RoundedRectangleBorder(
  116. borderRadius: BorderRadius.circular(50.r),
  117. ),
  118. ),
  119. child: Row(
  120. mainAxisSize: MainAxisSize.min,
  121. mainAxisAlignment: MainAxisAlignment.center,
  122. crossAxisAlignment: CrossAxisAlignment.center,
  123. spacing: 4,
  124. children: [
  125. Assets.images.iconLoginDialogWechatLogoWhite.image(
  126. width: 26.w,
  127. height: 26.w,
  128. ),
  129. Text(
  130. StringName.wechatLogin,
  131. textAlign: TextAlign.center,
  132. style: TextStyle(
  133. color: Colors.white,
  134. fontSize: 16.sp,
  135. fontWeight: FontWeight.w500,
  136. ),
  137. ),
  138. ],
  139. ),
  140. ),
  141. );
  142. }
  143. Widget _buildPrivacy() {
  144. return Row(
  145. mainAxisAlignment: MainAxisAlignment.center,
  146. children: [
  147. Obx(() {
  148. return GestureDetector(
  149. behavior: HitTestBehavior.opaque,
  150. onTap: () {
  151. controller.clickAgree();
  152. },
  153. child: Padding(
  154. padding: EdgeInsets.symmetric(vertical: 20.w,horizontal: 20.w),
  155. child:
  156. controller.isAgree
  157. ? Assets.images.iconLoginAgreePrivacy.image(
  158. width: 12.w,
  159. height: 12.w,
  160. )
  161. : Container(
  162. padding: EdgeInsets.all(1.w),
  163. width: 12.w,
  164. height: 12.w,
  165. child: Container(
  166. decoration: BoxDecoration(
  167. shape: BoxShape.circle,
  168. border: Border.all(
  169. color: Colors.black.withAlpha(153),
  170. width: 1.w,
  171. ),
  172. ),
  173. ),
  174. ),
  175. ),
  176. );
  177. }),
  178. Transform.translate(offset: Offset(-15.w,0),child: Text.rich(
  179. TextSpan(
  180. children: [
  181. TextSpan(
  182. text: StringName.textSpanIHaveReadAndAgree,
  183. style: TextStyle(
  184. color: Colors.black.withAlpha(128),
  185. fontSize: 12.sp,
  186. fontWeight: FontWeight.w400,
  187. ),
  188. ),
  189. ClickTextSpan(
  190. text: StringName.textSpanPrivacyPolicy,
  191. url: WebUrl.privacyPolicy,
  192. fontSize: 12.sp,
  193. color: Colors.black.withAlpha(204),
  194. ),
  195. TextSpan(
  196. text: StringName.textSpanAnd,
  197. style: TextStyle(
  198. color: Colors.black.withAlpha(128),
  199. fontSize: 12.sp,
  200. fontWeight: FontWeight.w400,
  201. ),
  202. ),
  203. ClickTextSpan(
  204. text: StringName.textSpanServiceTerms,
  205. url: WebUrl.serviceAgreement,
  206. color: Colors.black.withAlpha(204),
  207. fontSize: 12.sp,
  208. ),
  209. ],
  210. ),
  211. ),),
  212. ],
  213. );
  214. }
  215. }