mine_view.dart 9.0 KB

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