mine_view.dart 8.0 KB

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