mine_view.dart 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286
  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. onLongTap: controller.longClickTutorials
  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,
  68. ),
  69. baseFunctionButton(
  70. text: StringName.aboutUs,
  71. funIcon: Assets.images.iconMineAbout.path,
  72. onTap: controller.clickAboutUs,
  73. ),
  74. ],
  75. ),
  76. );
  77. }
  78. // 用户信息卡片
  79. Widget userCard() {
  80. return Obx(() {
  81. return Row(
  82. children: [
  83. controller.isLogin
  84. ? Assets.images.iconMineUserLogged.image(
  85. width: 56.r, height: 56.r)
  86. : Assets.images.iconMineUserNoLogin.image(
  87. width: 56.r,
  88. height: 56.r,
  89. ),
  90. SizedBox(width: 12.r),
  91. Text(
  92. controller.getUserName(),
  93. style: TextStyle(
  94. fontSize: 18.sp,
  95. color: Colors.black,
  96. fontWeight: FontWeight.w500,
  97. ),
  98. ),
  99. SizedBox(width: 4.r),
  100. Assets.images.iconMineLoginArrow.image(width: 16.r, height: 16.r),
  101. ],
  102. );
  103. });
  104. }
  105. // VIP 卡片
  106. Widget vipCard() {
  107. return Container(
  108. margin: EdgeInsets.only(top: 21.w),
  109. width: 326.w,
  110. height: 79.w,
  111. decoration: ShapeDecoration(
  112. image: DecorationImage(
  113. image: Assets.images.bgMineVipCard.provider(),
  114. fit: BoxFit.cover,
  115. ),
  116. shape: RoundedRectangleBorder(
  117. borderRadius: BorderRadius.circular(11.r),
  118. ),
  119. ),
  120. child: GestureDetector(
  121. behavior: HitTestBehavior.opaque,
  122. onTap: controller.clickVip,
  123. onLongPress: controller.longClickVip,
  124. child: Container(
  125. padding: EdgeInsets.only(left: 15.w, right: 15.w),
  126. width: 326.w,
  127. child: Row(
  128. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  129. children: [
  130. Column(
  131. crossAxisAlignment: CrossAxisAlignment.start,
  132. mainAxisAlignment: MainAxisAlignment.center,
  133. children: [
  134. // vip 图标
  135. Assets.images.iconMineVip.image(width: 62.w, height: 19.h),
  136. // vip描述文本
  137. Row(
  138. children: [
  139. Text(
  140. StringName.vipLevel0Desc,
  141. style: TextStyle(
  142. color: Color(0xFFE4B483),
  143. fontSize: 12.sp,
  144. fontWeight: FontWeight.w400,
  145. ),
  146. ),
  147. Assets.images.iconMineVipDescArrow.image(
  148. width: 16.w,
  149. height: 16.h,
  150. ),
  151. ],
  152. ),
  153. ],
  154. ),
  155. // VIP按钮
  156. Container(
  157. alignment: Alignment.center,
  158. width: 80.w,
  159. height: 28.h,
  160. decoration: ShapeDecoration(
  161. gradient: LinearGradient(
  162. begin: Alignment(-0.94.r, 0.35.r),
  163. end: Alignment(0.94.r, -0.35.r),
  164. colors: [
  165. Color(0xFFFFD79C),
  166. Color(0xFFF19F45),
  167. Color(0xFFF19F45),
  168. Color(0xFFFFC387),
  169. ],
  170. ),
  171. shape: RoundedRectangleBorder(
  172. side: BorderSide(width: 1.w, color: Color(0xFFEA973E)),
  173. borderRadius: BorderRadius.circular(32.r),
  174. ),
  175. ),
  176. child: Row(
  177. mainAxisAlignment: MainAxisAlignment.center,
  178. children: [
  179. Text(
  180. StringName.vipLevel0Btn,
  181. textAlign: TextAlign.center,
  182. style: TextStyle(
  183. color: Colors.white,
  184. fontSize: 13.sp,
  185. fontWeight: FontWeight.w400,
  186. ),
  187. ),
  188. Assets.images.iconMineVipArrow.image(
  189. width: 10.w,
  190. height: 10.w,
  191. ),
  192. ],
  193. ),
  194. ),
  195. ],
  196. ),
  197. ),
  198. ),
  199. );
  200. }
  201. // 基础设置按钮
  202. Widget baseSettingButton({
  203. required String text,
  204. required Widget btnIcon,
  205. required VoidCallback onTap,
  206. }) {
  207. return GestureDetector(
  208. onTap: onTap,
  209. child: Container(
  210. width: 158.w,
  211. height: 44.h,
  212. decoration: ShapeDecoration(
  213. color: Colors.white,
  214. shape: RoundedRectangleBorder(
  215. borderRadius: BorderRadius.circular(10.r),
  216. ),
  217. ),
  218. child: Row(
  219. crossAxisAlignment: CrossAxisAlignment.center,
  220. mainAxisAlignment: MainAxisAlignment.center,
  221. children: [
  222. btnIcon,
  223. SizedBox(width: 8.w),
  224. Text(
  225. text,
  226. style: TextStyle(
  227. color: Colors.black,
  228. fontSize: 14.sp,
  229. fontWeight: FontWeight.w500,
  230. ),
  231. ),
  232. ],
  233. ),
  234. ),
  235. );
  236. }
  237. //基础功能按钮
  238. Widget baseFunctionButton({
  239. required String text,
  240. required String funIcon,
  241. required VoidCallback onTap,
  242. VoidCallback? onLongTap,
  243. }) {
  244. return GestureDetector(
  245. onTap: onTap,
  246. onLongPress: onLongTap,
  247. behavior: HitTestBehavior.opaque,
  248. child: Padding(
  249. padding: EdgeInsets.only(bottom: 12.h),
  250. child: Row(
  251. crossAxisAlignment: CrossAxisAlignment.center,
  252. mainAxisAlignment: MainAxisAlignment.center,
  253. children: [
  254. Image.asset(funIcon, width: 24.w, height: 24.w),
  255. SizedBox(width: 10.w),
  256. Text(
  257. text,
  258. style: TextStyle(
  259. color: Colors.black,
  260. fontSize: 14.sp,
  261. fontWeight: FontWeight.w400,
  262. ),
  263. ),
  264. Spacer(),
  265. Assets.images.iconMineArrow.image(width: 20.w, height: 20.w),
  266. ],
  267. ),
  268. ),
  269. );
  270. }
  271. }