mine_view.dart 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. import 'dart:io';
  2. import 'package:flutter/material.dart';
  3. import 'package:flutter_screenutil/flutter_screenutil.dart';
  4. import 'package:keyboard/base/base_view.dart';
  5. import 'package:keyboard/module/feedback/feedback_controller.dart';
  6. import 'package:keyboard/module/mine/mine_controller.dart';
  7. import 'package:keyboard/resource/string.gen.dart';
  8. import '../../resource/assets.gen.dart';
  9. import 'package:get/get.dart';
  10. class MineView extends BaseView<MineController> {
  11. const MineView({super.key});
  12. @override
  13. Color backgroundColor() {
  14. return const Color(0xFFF6F5FA);
  15. }
  16. @override
  17. Widget buildBody(BuildContext context) {
  18. return Stack(
  19. children: [
  20. SafeArea(
  21. child: SingleChildScrollView(
  22. child: Column(children: [heardCard(), functionCard()]),
  23. ),
  24. ),
  25. IgnorePointer(child: Assets.images.bgMine.image(width: 360.w)),
  26. ],
  27. );
  28. }
  29. Widget heardCard() {
  30. return Container(
  31. margin: EdgeInsets.only(top: 36.w, left: 16.w, right: 16.w),
  32. child: Column(children: [userCard(), vipCard()]),
  33. );
  34. }
  35. // 更多功能
  36. Widget functionCard() {
  37. return Container(
  38. padding: EdgeInsets.only(top: 18.w, left: 16.w, right: 16.w, bottom: 6.w),
  39. margin: EdgeInsets.only(top: 12.w, left: 16.w, right: 16.w),
  40. width: 328.w,
  41. // height: 348.h,
  42. decoration: ShapeDecoration(
  43. color: Colors.white,
  44. shape: RoundedRectangleBorder(
  45. borderRadius: BorderRadius.circular(12.r),
  46. ),
  47. ),
  48. child: Column(
  49. children: [
  50. baseFunctionButton(
  51. text: StringName.personalProfile,
  52. funIcon: Assets.images.iconMinePersonalProfile.path,
  53. onTap: controller.clickPersonalProfile,
  54. ),
  55. baseFunctionButton(
  56. text: StringName.tutorials,
  57. funIcon: Assets.images.iconMineTutorials.path,
  58. onTap: controller.clickTutorials,
  59. ),
  60. baseFunctionButton(
  61. text: StringName.onlineCustomerService,
  62. funIcon: Assets.images.iconMineOnlineCustomerService.path,
  63. onTap: controller.clickOnlineCustomerService,
  64. ),
  65. if (Platform.isAndroid)
  66. baseFunctionButton(
  67. text: StringName.autoRenewalManagement,
  68. funIcon: Assets.images.iconMineAutoRenewal.path,
  69. onTap: controller.clickAutoRenewal,
  70. ),
  71. baseFunctionButton(
  72. text: StringName.feedback,
  73. funIcon: Assets.images.iconMineFeedback.path,
  74. onTap: () {
  75. controller.clickFeedback(FeedbackType.feedback);
  76. },
  77. ),
  78. baseFunctionButton(
  79. text: StringName.complaintReport,
  80. funIcon: Assets.images.iconMineComplaint.path,
  81. onTap: () {
  82. controller.clickFeedback(FeedbackType.complaint);
  83. },
  84. ),
  85. baseFunctionButton(
  86. text: StringName.aboutUs,
  87. funIcon: Assets.images.iconMineAbout.path,
  88. onTap: controller.clickAboutUs,
  89. ),
  90. ],
  91. ),
  92. );
  93. }
  94. // 用户信息卡片
  95. Widget userCard() {
  96. return Obx(() {
  97. return GestureDetector(
  98. onTap: controller.clickUserCard,
  99. child: Row(
  100. children: [
  101. controller.isLogin
  102. ? Assets.images.iconMineUserLogged.image(
  103. width: 56.r,
  104. height: 56.r,
  105. fit: BoxFit.contain,
  106. )
  107. : Assets.images.iconMineUserNoLogin.image(
  108. width: 56.r,
  109. height: 56.r,
  110. fit: BoxFit.contain,
  111. ),
  112. SizedBox(width: 12.r),
  113. Text(
  114. controller.getUserName(),
  115. style: TextStyle(
  116. fontSize: 18.sp,
  117. color: Colors.black,
  118. fontWeight: FontWeight.w500,
  119. ),
  120. ),
  121. SizedBox(width: 4.r),
  122. Assets.images.iconMineLoginArrow.image(width: 16.r, height: 16.r),
  123. ],
  124. ),
  125. );
  126. });
  127. }
  128. // VIP 卡片
  129. Widget vipCard() {
  130. return Container(
  131. margin: EdgeInsets.only(top: 21.w),
  132. width: 327.w,
  133. height: 143.w,
  134. decoration: ShapeDecoration(
  135. image: DecorationImage(
  136. image: Assets.images.bgMineVipCard.provider(),
  137. fit: BoxFit.contain,
  138. ),
  139. shape: RoundedRectangleBorder(
  140. borderRadius: BorderRadius.circular(11.r),
  141. ),
  142. ),
  143. child: GestureDetector(
  144. behavior: HitTestBehavior.opaque,
  145. onTap: controller.clickVip,
  146. child: Container(
  147. padding: EdgeInsets.only(left: 15.w, right: 15.w, bottom: 88.w),
  148. width: 326.w,
  149. child: Row(
  150. crossAxisAlignment: CrossAxisAlignment.end,
  151. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  152. children: [
  153. Column(
  154. crossAxisAlignment: CrossAxisAlignment.start,
  155. mainAxisAlignment: MainAxisAlignment.end,
  156. children: [
  157. // vip 图标
  158. Assets.images.iconMineVip.image(width: 62.w, height: 19.h),
  159. // vip描述文本
  160. Obx(() {
  161. return Row(
  162. children: [
  163. Text(
  164. controller.getVipLevelDesc(),
  165. style: TextStyle(
  166. color: Color(0xFFE4B483),
  167. fontSize: 12.sp,
  168. fontWeight: FontWeight.w400,
  169. ),
  170. ),
  171. Assets.images.iconMineVipDescArrow.image(
  172. width: 16.w,
  173. height: 16.h,
  174. ),
  175. ],
  176. );
  177. }),
  178. ],
  179. ),
  180. // VIP按钮
  181. Container(
  182. alignment: Alignment.center,
  183. width: 80.w,
  184. height: 28.h,
  185. decoration: ShapeDecoration(
  186. gradient: LinearGradient(
  187. begin: Alignment(-0.94.r, 0.35.r),
  188. end: Alignment(0.94.r, -0.35.r),
  189. colors: [
  190. Color(0xFFFFD79C),
  191. Color(0xFFF19F45),
  192. Color(0xFFF19F45),
  193. Color(0xFFFFC387),
  194. ],
  195. ),
  196. shape: RoundedRectangleBorder(
  197. side: BorderSide(width: 1.w, color: Color(0xFFEA973E)),
  198. borderRadius: BorderRadius.circular(32.r),
  199. ),
  200. ),
  201. child: Obx(() {
  202. return Row(
  203. mainAxisAlignment: MainAxisAlignment.center,
  204. children: [
  205. Text(
  206. controller.getVipButtonDesc(),
  207. textAlign: TextAlign.center,
  208. style: TextStyle(
  209. color: Colors.white,
  210. fontSize: 13.sp,
  211. fontWeight: FontWeight.w400,
  212. ),
  213. ),
  214. Assets.images.iconMineVipArrow.image(
  215. width: 10.w,
  216. height: 10.w,
  217. ),
  218. ],
  219. );
  220. }),
  221. ),
  222. ],
  223. ),
  224. ),
  225. ),
  226. );
  227. }
  228. // 基础设置按钮
  229. Widget baseSettingButton({
  230. required String text,
  231. required Widget btnIcon,
  232. required VoidCallback onTap,
  233. }) {
  234. return GestureDetector(
  235. onTap: onTap,
  236. child: Container(
  237. width: 158.w,
  238. height: 44.h,
  239. decoration: ShapeDecoration(
  240. color: Colors.white,
  241. shape: RoundedRectangleBorder(
  242. borderRadius: BorderRadius.circular(10.r),
  243. ),
  244. ),
  245. child: Row(
  246. crossAxisAlignment: CrossAxisAlignment.center,
  247. mainAxisAlignment: MainAxisAlignment.center,
  248. children: [
  249. btnIcon,
  250. SizedBox(width: 8.w),
  251. Text(
  252. text,
  253. style: TextStyle(
  254. color: Colors.black,
  255. fontSize: 14.sp,
  256. fontWeight: FontWeight.w500,
  257. ),
  258. ),
  259. ],
  260. ),
  261. ),
  262. );
  263. }
  264. //基础功能按钮
  265. Widget baseFunctionButton({
  266. required String text,
  267. required String funIcon,
  268. required VoidCallback onTap,
  269. VoidCallback? onLongTap,
  270. }) {
  271. return GestureDetector(
  272. onTap: onTap,
  273. onLongPress: onLongTap,
  274. behavior: HitTestBehavior.opaque,
  275. child: Padding(
  276. padding: EdgeInsets.only(bottom: 20.h),
  277. child: Row(
  278. crossAxisAlignment: CrossAxisAlignment.center,
  279. mainAxisAlignment: MainAxisAlignment.center,
  280. children: [
  281. Image.asset(funIcon, width: 24.w, height: 24.w),
  282. SizedBox(width: 10.w),
  283. Text(
  284. text,
  285. style: TextStyle(
  286. color: Colors.black,
  287. fontSize: 14.sp,
  288. fontWeight: FontWeight.w400,
  289. ),
  290. ),
  291. Spacer(),
  292. Assets.images.iconMineArrow.image(width: 20.w, height: 20.w),
  293. ],
  294. ),
  295. ),
  296. );
  297. }
  298. }