mine_view.dart 8.2 KB

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