mine_view.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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 Color(0xFFF6F5FA);
  12. }
  13. @override
  14. Widget buildBody(BuildContext context) {
  15. return Stack(
  16. children: [
  17. SafeArea(
  18. child: SingleChildScrollView(
  19. child: Column(
  20. children: [heardCard(), baseSettingCard(), functionCard()],
  21. ),
  22. ),
  23. ),
  24. IgnorePointer(child: Assets.images.bgMine.image(width: 360.w)),
  25. ],
  26. );
  27. }
  28. Widget heardCard() {
  29. return Container(
  30. margin: EdgeInsets.only(top: 36.w, left: 16.w, right: 16.w),
  31. child: Column(children: [userCard(), vipCard()]),
  32. );
  33. }
  34. // 更多功能
  35. Widget functionCard() {
  36. return Container(
  37. padding: EdgeInsets.only(top: 18.w, left: 16.w, right: 16.w, bottom: 6.w),
  38. margin: EdgeInsets.only(top: 12.w, left: 16.w, right: 16.w),
  39. width: 328.w,
  40. // height: 348.h,
  41. decoration: ShapeDecoration(
  42. color: Colors.white,
  43. shape: RoundedRectangleBorder(
  44. borderRadius: BorderRadius.circular(12.r),
  45. ),
  46. ),
  47. child: Column(
  48. children: [
  49. baseFunctionButton(
  50. text: StringName.onlineCustomerService,
  51. funIcon: Assets.images.iconMineOnlineCustomerService.path,
  52. onTap: () => controller.clickOnlineCustomerService(),
  53. ),
  54. baseFunctionButton(
  55. text: StringName.setting,
  56. funIcon: Assets.images.iconMineSettings.path,
  57. onTap: () => controller.clickSetting(),
  58. ),
  59. baseFunctionButton(
  60. text: StringName.userAgreement,
  61. funIcon: Assets.images.iconMineUserAgreement.path,
  62. onTap: () => controller.clickUserAgreement(),
  63. ),
  64. baseFunctionButton(
  65. text: StringName.privacyPolicy,
  66. funIcon: Assets.images.iconMinePrivacy.path,
  67. onTap: () => controller.clickPrivacyPolicy(),
  68. ),
  69. baseFunctionButton(
  70. text: StringName.feedback,
  71. funIcon: Assets.images.iconMineFeedback.path,
  72. onTap: () => controller.clickFeedback(),
  73. ),
  74. baseFunctionButton(
  75. text: StringName.systemNotification,
  76. funIcon: Assets.images.iconMineSystemNotification.path,
  77. onTap: () => controller.clickSystemNotification(),
  78. ),
  79. baseFunctionButton(
  80. text: StringName.aboutUs,
  81. funIcon: Assets.images.iconMineAbout.path,
  82. onTap: () => controller.clickAboutUs(),
  83. ),
  84. baseFunctionButton(
  85. text: StringName.shareApp,
  86. funIcon: Assets.images.iconMineShare.path,
  87. onTap: () => controller.clickShare(),
  88. ),
  89. baseFunctionButton(
  90. text: StringName.reportComplaint,
  91. funIcon: Assets.images.iconMineReportComplaint.path,
  92. onTap: () => controller.clickReportComplaint(),
  93. ),
  94. ],
  95. ),
  96. );
  97. }
  98. Widget baseSettingCard() {
  99. return Container(
  100. margin: EdgeInsets.only(top: 13.w, left: 16.w, right: 16.w),
  101. child: Row(
  102. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  103. children: [
  104. baseSettingButton(
  105. text: StringName.preset,
  106. btnIcon: Assets.images.iconMinePreset.image(
  107. width: 20.w,
  108. height: 20.h,
  109. ),
  110. onTap: () {
  111. controller.clickPreset();
  112. },
  113. ),
  114. baseSettingButton(
  115. text: StringName.keyboardSetting,
  116. btnIcon: Assets.images.iconMineKeyboardSetting.image(
  117. width: 20.w,
  118. height: 20.h,
  119. ),
  120. onTap: () {
  121. controller.clickKeyboardSetting();
  122. },
  123. ),
  124. ],
  125. ),
  126. );
  127. }
  128. // 用户信息卡片
  129. Widget userCard() {
  130. return Row(
  131. children: [
  132. controller.isLogin
  133. ? Assets.images.iconMineUserLogged.image(width: 56.r, height: 56.r)
  134. : Assets.images.iconMineUserNoLogin.image(
  135. width: 56.r,
  136. height: 56.r,
  137. ),
  138. SizedBox(width: 12.r),
  139. controller.isLogin
  140. ? Text(
  141. controller.getUserName(),
  142. style: TextStyle(
  143. fontSize: 18.sp,
  144. color: Colors.black,
  145. fontWeight: FontWeight.w500,
  146. ),
  147. )
  148. : Text(
  149. StringName.loginAccount,
  150. style: TextStyle(
  151. fontSize: 18.sp,
  152. color: Colors.black,
  153. fontWeight: FontWeight.w500,
  154. ),
  155. ),
  156. SizedBox(width: 4.r),
  157. Assets.images.iconMineLoginArrow.image(width: 16.r, height: 16.r),
  158. ],
  159. );
  160. }
  161. // VIP 卡片
  162. Widget vipCard() {
  163. return Container(
  164. margin: EdgeInsets.only(top: 21.w),
  165. width: 326.w,
  166. height: 108.w,
  167. decoration: ShapeDecoration(
  168. image: DecorationImage(
  169. image: Assets.images.bgMineVipCard.provider(),
  170. fit: BoxFit.cover,
  171. ),
  172. shape: RoundedRectangleBorder(
  173. borderRadius: BorderRadius.circular(11.r),
  174. ),
  175. ),
  176. child: Stack(
  177. children: [
  178. Positioned(
  179. top: 19.w,
  180. left: 15.w,
  181. right: 15.w,
  182. child: GestureDetector(
  183. behavior: HitTestBehavior.opaque,
  184. onTap: controller.clickVip,
  185. child: SizedBox(
  186. width: 326.w,
  187. child: Row(
  188. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  189. children: [
  190. Column(
  191. crossAxisAlignment: CrossAxisAlignment.start,
  192. children: [
  193. // vip 图标
  194. Assets.images.iconMineVip.image(
  195. width: 62.w,
  196. height: 19.h,
  197. ),
  198. // vip描述文本
  199. Row(
  200. children: [
  201. Text(
  202. StringName.vipLevel0Desc,
  203. style: TextStyle(
  204. color: Color(0xFFE4B483),
  205. fontSize: 12.sp,
  206. fontWeight: FontWeight.w400,
  207. ),
  208. ),
  209. Assets.images.iconMineVipDescArrow.image(
  210. width: 16.w,
  211. height: 16.h,
  212. ),
  213. ],
  214. ),
  215. ],
  216. ),
  217. // VIP按钮
  218. Container(
  219. alignment: Alignment.center,
  220. width: 80.w,
  221. height: 28.h,
  222. decoration: ShapeDecoration(
  223. gradient: LinearGradient(
  224. begin: Alignment(-0.94.r, 0.35.r),
  225. end: Alignment(0.94.r, -0.35.r),
  226. colors: [
  227. Color(0xFFFFD79C),
  228. Color(0xFFF19F45),
  229. Color(0xFFF19F45),
  230. Color(0xFFFFC387),
  231. ],
  232. ),
  233. shape: RoundedRectangleBorder(
  234. side: BorderSide(
  235. width: 1.w,
  236. color: Color(0xFFEA973E),
  237. ),
  238. borderRadius: BorderRadius.circular(32.r),
  239. ),
  240. ),
  241. child: Row(
  242. mainAxisAlignment: MainAxisAlignment.center,
  243. children: [
  244. Text(
  245. StringName.vipLevel0Btn,
  246. textAlign: TextAlign.center,
  247. style: TextStyle(
  248. color: Colors.white,
  249. fontSize: 13.sp,
  250. fontWeight: FontWeight.w400,
  251. ),
  252. ),
  253. Assets.images.iconMineVipArrow.image(
  254. width: 10.w,
  255. height: 10.w,
  256. ),
  257. ],
  258. ),
  259. ),
  260. ],
  261. ),
  262. ),
  263. ),
  264. ),
  265. // 我的订单
  266. Positioned(
  267. bottom: 7.h,
  268. left: 16.w,
  269. child: GestureDetector(
  270. onTap: controller.clickOrders,
  271. behavior: HitTestBehavior.opaque,
  272. child: SizedBox(
  273. width: 320.w,
  274. child: Row(
  275. mainAxisAlignment: MainAxisAlignment.center,
  276. children: [
  277. Assets.images.iconMineOrderLogo.image(
  278. width: 16.w,
  279. height: 16.h,
  280. ),
  281. SizedBox(width: 2.w),
  282. Text(
  283. StringName.myOrders,
  284. style: TextStyle(
  285. color: Color(0xFFE79F63),
  286. fontSize: 12.sp,
  287. fontWeight: FontWeight.w400,
  288. ),
  289. ),
  290. Assets.images.iconMineVipOrderArrow.image(
  291. width: 16.w,
  292. height: 16.h,
  293. ),
  294. Expanded(child: SizedBox.shrink()),
  295. ],
  296. ),
  297. ),
  298. ),
  299. ),
  300. ],
  301. ),
  302. );
  303. }
  304. // 基础设置按钮
  305. Widget baseSettingButton({
  306. required String text,
  307. required Widget btnIcon,
  308. required VoidCallback onTap,
  309. }) {
  310. return GestureDetector(
  311. onTap: onTap,
  312. child: Container(
  313. width: 158.w,
  314. height: 44.h,
  315. decoration: ShapeDecoration(
  316. color: Colors.white,
  317. shape: RoundedRectangleBorder(
  318. borderRadius: BorderRadius.circular(10.r),
  319. ),
  320. ),
  321. child: Row(
  322. crossAxisAlignment: CrossAxisAlignment.center,
  323. mainAxisAlignment: MainAxisAlignment.center,
  324. children: [
  325. btnIcon,
  326. SizedBox(width: 8.w),
  327. Text(
  328. text,
  329. style: TextStyle(
  330. color: Colors.black,
  331. fontSize: 14.sp,
  332. fontWeight: FontWeight.w500,
  333. ),
  334. ),
  335. ],
  336. ),
  337. ),
  338. );
  339. }
  340. //基础功能按钮
  341. Widget baseFunctionButton({
  342. required String text,
  343. required String funIcon,
  344. required VoidCallback onTap,
  345. }) {
  346. return GestureDetector(
  347. onTap: onTap,
  348. behavior: HitTestBehavior.opaque,
  349. child: Padding(
  350. padding: EdgeInsets.only(bottom: 12.h),
  351. child: Row(
  352. crossAxisAlignment: CrossAxisAlignment.center,
  353. mainAxisAlignment: MainAxisAlignment.center,
  354. children: [
  355. Image.asset(funIcon, width: 24.w, height: 24.w),
  356. SizedBox(width: 10.w),
  357. Text(
  358. text,
  359. style: TextStyle(
  360. color: Colors.black,
  361. fontSize: 14.sp,
  362. fontWeight: FontWeight.w400,
  363. ),
  364. ),
  365. Spacer(),
  366. Assets.images.iconMineArrow.image(width: 20.w, height: 20.w),
  367. ],
  368. ),
  369. ),
  370. );
  371. }
  372. }