mine_view.dart 8.3 KB

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