mine_view.dart 8.6 KB

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