rewards_page.dart 33 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769
  1. import 'dart:ffi';
  2. import 'package:cpt_rewards/modules/rewards_address/rewards_address_page.dart';
  3. import 'package:cpt_rewards/modules/rewards_code/rewards_code_page.dart';
  4. import 'package:cpt_rewards/modules/rewards_history/rewards_history_page.dart';
  5. import 'package:cpt_rewards/modules/rewards_home/rewards_home_page.dart';
  6. import 'package:cpt_rewards/modules/rewards_list/rewards_list_page.dart';
  7. import 'package:cpt_rewards/modules/rewards_my/rewards_my_page.dart';
  8. import 'package:cs_resources/generated/assets.dart';
  9. import 'package:cs_resources/generated/l10n.dart';
  10. import 'package:cs_resources/theme/app_colors_theme.dart';
  11. import 'package:cs_resources/theme/theme_config.dart';
  12. import 'package:domain/entity/rewards_index_entity.dart';
  13. import 'package:flutter/material.dart';
  14. import 'package:auto_route/auto_route.dart';
  15. import 'package:flutter/services.dart';
  16. import 'package:flutter_hooks/flutter_hooks.dart';
  17. import 'package:hooks_riverpod/hooks_riverpod.dart';
  18. import 'package:plugin_basic/modules/global_web_page.dart';
  19. import 'package:plugin_platform/engine/image/image_nine_grid.dart';
  20. import 'package:router/ext/auto_router_extensions.dart';
  21. import 'package:shared/utils/color_utils.dart';
  22. import 'package:shared/utils/log_utils.dart';
  23. import 'package:widgets/ext/ex_widget.dart';
  24. import 'package:widgets/load_state_layout.dart';
  25. import 'package:widgets/my_appbar.dart';
  26. import 'package:widgets/my_load_image.dart';
  27. import 'package:widgets/widget_export.dart';
  28. import 'package:intl/intl.dart';
  29. import '../../../router/page/rewards_page_router.dart';
  30. import './rewards_vm.dart';
  31. @RoutePage()
  32. class RewardsPage extends HookConsumerWidget {
  33. const RewardsPage({Key? key}) : super(key: key);
  34. //启动当前页面
  35. static void startInstance({BuildContext? context}) {
  36. if (context != null) {
  37. context.router.push(const RewardsPageRoute());
  38. } else {
  39. appRouter.push(const RewardsPageRoute());
  40. }
  41. }
  42. @override
  43. Widget build(BuildContext context, WidgetRef ref) {
  44. final _vm = ref.read(rewardsVmProvider.notifier);
  45. final state = ref.watch(rewardsVmProvider);
  46. RewardsIndexEntity? list = state.list;
  47. useEffect(() {
  48. // 组件挂载时执行 - 执行接口请求
  49. Future.microtask(() => _vm.initPageData());
  50. return () {
  51. // 组件卸载时执行
  52. Log.d("property_news_page 组件卸载时执行");
  53. };
  54. }, []);
  55. return Scaffold(
  56. appBar: MyAppBar.appBar(context, S.current.daily_login,
  57. backIconPath: Assets.rewardsRewardsBack,
  58. backIconWidth: 32.0,
  59. backIconHeight: 32.0,
  60. titleColor: Colors.white,
  61. titleDarkColor: Colors.white,
  62. showBackButton: true,
  63. backgroundColor: context.appColors.btnBgDefault,
  64. systemUiOverlayStyle: MediaQuery.of(context).platformBrightness == Brightness.dark
  65. ? ThemeConfig.systemUiOverlayStyleDarkTheme
  66. : ThemeConfig.systemUiOverlayStyleLightThemeWhite,
  67. actions: [
  68. const MyAssetImage(
  69. Assets.rewardsRewardsIconWen,
  70. width: 20,
  71. height: 20,
  72. ).marginOnly(right: 15).onTap(() {
  73. // 去详情
  74. // _vm.launchURL(url);
  75. GlobalWebPage.startInstance(context: context, title: S.current.how_do_i_earn_points, url: 'https://yyjobs.sg/terms/PointsRules.html');
  76. })
  77. ]),
  78. body: Column(children: [
  79. Expanded(
  80. child: LoadStateLayout(
  81. state: state.loadingState,
  82. errorMessage: state.errorMessage,
  83. errorRetry: () {
  84. _vm.retryRequest();
  85. },
  86. successWidget: SingleChildScrollView(
  87. scrollDirection: Axis.vertical,
  88. physics: const BouncingScrollPhysics(),
  89. clipBehavior: Clip.none,
  90. child: Column(
  91. children: [
  92. _buildTop(context, ref, _vm, list),
  93. Container(
  94. transform: Matrix4.translationValues(0.0, -45.0, 0.0),
  95. child: Column(
  96. children: [
  97. _buildSearch(context, ref, _vm, list),
  98. _buildSwiper(context, ref, _vm, list),
  99. list?.points != 0 ? _buildList(context, ref, _vm, list) : const SizedBox.shrink(),
  100. _buildHistory(context, ref, _vm, list),
  101. ],
  102. ), // 使用负数margin
  103. ).paddingOnly(left: 15, right: 15),
  104. ],
  105. )),
  106. ),
  107. ),
  108. ]).backgroundColor(ColorUtils.string2Color('#F2F3F6')),
  109. );
  110. }
  111. Widget _buildTop(BuildContext context, WidgetRef ref, _vm, RewardsIndexEntity? list) {
  112. int points = list?.points ?? 0;
  113. return Container(
  114. decoration: BoxDecoration(
  115. border: Border(
  116. bottom: BorderSide(
  117. color: ColorUtils.string2Color('#4161D0'), // 设置bottom边框的颜色
  118. width: 45.0, // 设置bottom边框的宽度
  119. )),
  120. borderRadius: const BorderRadius.only(
  121. topLeft: Radius.circular(0.0),
  122. topRight: Radius.circular(0.0),
  123. bottomLeft: Radius.circular(30.0),
  124. bottomRight: Radius.circular(30.0),
  125. ), // 圆角
  126. ),
  127. child: Column(
  128. crossAxisAlignment: CrossAxisAlignment.start,
  129. children: [
  130. Row(
  131. crossAxisAlignment: CrossAxisAlignment.center,
  132. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  133. children: [
  134. Text(
  135. S.current.available_points,
  136. style: const TextStyle(fontSize: 17.0, color: Colors.white, fontWeight: FontWeight.w500), // 设置字体大小
  137. ),
  138. Container(
  139. decoration: BoxDecoration(
  140. border: Border.all(color: Colors.white, width: 1), // 边框
  141. borderRadius: BorderRadius.circular(8), // 圆角
  142. ),
  143. child: Row(
  144. children: [
  145. const MyAssetImage(
  146. Assets.rewardsRewardsIconJb,
  147. width: 23,
  148. height: 23,
  149. ).marginOnly(right: 5),
  150. Text(
  151. '$points',
  152. style: const TextStyle(fontSize: 15.0, color: Colors.white, fontWeight: FontWeight.w400), // 设置字体大小
  153. ),
  154. ],
  155. ).paddingOnly(left: 10, top: 7, bottom: 7, right: 10),
  156. ),
  157. ],
  158. ).paddingOnly(left: 10, top: 0, bottom: 18),
  159. ],
  160. )
  161. .paddingOnly(top: 15, left: 5, right: 15, bottom: 0)
  162. .border(bottom: 0, color: ColorUtils.string2Color('#4161D0'))
  163. .backgroundColor(ColorUtils.string2Color('#4161D0')));
  164. }
  165. Widget _buildSearch(BuildContext context, WidgetRef ref, _vm, RewardsIndexEntity? list) {
  166. final dateFormat = DateFormat('yyyy-MM-dd');
  167. final now = DateFormat('yyyy-MM-dd').format(DateTime.now());
  168. // final date = list.continuous.currentWeekCheckin[0] ?? now;
  169. final date = now;
  170. final date0 = DateFormat('MM-dd').format(dateFormat.parse(date).subtract(const Duration(days: 1)));
  171. final date1 = DateFormat('MM-dd').format(dateFormat.parse(date).add(const Duration(days: 1)));
  172. final date2 = DateFormat('MM-dd').format(dateFormat.parse(date).add(const Duration(days: 2)));
  173. final date3 = DateFormat('MM-dd').format(dateFormat.parse(date).add(const Duration(days: 3)));
  174. final date4 = DateFormat('MM-dd').format(dateFormat.parse(date).add(const Duration(days: 4)));
  175. final date5 = DateFormat('MM-dd').format(dateFormat.parse(date).add(const Duration(days: 5)));
  176. // final nextDate = date.add(Duration(days: 1));
  177. return Container(
  178. width: MediaQuery.of(context).size.width - 30,
  179. decoration: BoxDecoration(
  180. color: Colors.white,
  181. borderRadius: BorderRadius.circular(10),
  182. boxShadow: const [BoxShadow(color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)],
  183. ),
  184. child: Column(
  185. crossAxisAlignment: CrossAxisAlignment.start,
  186. mainAxisAlignment: MainAxisAlignment.center,
  187. children: [
  188. Text(
  189. S.current.continuous_login_8_day,
  190. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  191. ),
  192. Flex(
  193. direction: Axis.horizontal,
  194. children: [
  195. Expanded(
  196. flex: 1,
  197. child: Container(
  198. decoration: BoxDecoration(
  199. color: ColorUtils.string2Color('#F2F3F6'),
  200. borderRadius: BorderRadius.circular(10),
  201. border: Border.all(color: ColorUtils.string2Color('#4161D0'), width: 1),
  202. ),
  203. height: 78,
  204. child: Column(
  205. crossAxisAlignment: CrossAxisAlignment.center,
  206. mainAxisAlignment: MainAxisAlignment.center,
  207. children: [
  208. Text(
  209. '$date0',
  210. style: TextStyle(fontSize: 13.0, color: ColorUtils.string2Color('#4161D0'), fontWeight: FontWeight.w400), // 设置字体大小
  211. ),
  212. const MyAssetImage(
  213. Assets.rewardsRewardsIconJb,
  214. width: 23,
  215. height: 23,
  216. ),
  217. Text(
  218. '+2',
  219. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#4161D0'), fontWeight: FontWeight.w500), // 设置字体大小
  220. ),
  221. ],
  222. ),
  223. ),
  224. ),
  225. const SizedBox(width: 15.0),
  226. Expanded(
  227. flex: 1,
  228. child: Container(
  229. decoration: BoxDecoration(
  230. color: ColorUtils.string2Color('#4161D0'),
  231. borderRadius: BorderRadius.circular(10),
  232. border: Border.all(color: ColorUtils.string2Color('#4161D0'), width: 1),
  233. ),
  234. height: 78,
  235. child: Column(
  236. crossAxisAlignment: CrossAxisAlignment.center,
  237. mainAxisAlignment: MainAxisAlignment.center,
  238. children: [
  239. Text(
  240. 'Today',
  241. style: TextStyle(fontSize: 13.0, color: ColorUtils.string2Color('#ffffff'), fontWeight: FontWeight.w400), // 设置字体大小
  242. ),
  243. const MyAssetImage(
  244. Assets.rewardsRewardsIconJb,
  245. width: 23,
  246. height: 23,
  247. ),
  248. Text(
  249. '+2',
  250. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#ffffff'), fontWeight: FontWeight.w500), // 设置字体大小
  251. ),
  252. ],
  253. ),
  254. ),
  255. ),
  256. const SizedBox(width: 15.0),
  257. Expanded(
  258. flex: 1,
  259. child: Container(
  260. decoration: BoxDecoration(
  261. color: ColorUtils.string2Color('#F2F3F6'),
  262. borderRadius: BorderRadius.circular(10),
  263. border: Border.all(color: ColorUtils.string2Color('#F2F3F6'), width: 1),
  264. ),
  265. height: 78,
  266. child: Column(
  267. crossAxisAlignment: CrossAxisAlignment.center,
  268. mainAxisAlignment: MainAxisAlignment.center,
  269. children: [
  270. Text(
  271. '$date1',
  272. style: TextStyle(fontSize: 13.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w400), // 设置字体大小
  273. ),
  274. const MyAssetImage(
  275. Assets.rewardsRewardsIconJb,
  276. width: 23,
  277. height: 23,
  278. ),
  279. Text(
  280. '+2',
  281. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  282. ),
  283. ],
  284. ),
  285. ),
  286. ),
  287. const SizedBox(width: 15.0),
  288. Expanded(
  289. flex: 1,
  290. child: Container(
  291. decoration: BoxDecoration(
  292. color: ColorUtils.string2Color('#F2F3F6'),
  293. borderRadius: BorderRadius.circular(10),
  294. border: Border.all(color: ColorUtils.string2Color('#F2F3F6'), width: 1),
  295. ),
  296. height: 78,
  297. child: Column(
  298. crossAxisAlignment: CrossAxisAlignment.center,
  299. mainAxisAlignment: MainAxisAlignment.center,
  300. children: [
  301. Text(
  302. '$date2',
  303. style: TextStyle(fontSize: 13.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w400), // 设置字体大小
  304. ),
  305. const MyAssetImage(
  306. Assets.rewardsRewardsIconJb,
  307. width: 23,
  308. height: 23,
  309. ),
  310. Text(
  311. '+2',
  312. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  313. ),
  314. ],
  315. ),
  316. ),
  317. ),
  318. ],
  319. ).marginOnly(top: 13, bottom: 13),
  320. Flex(
  321. direction: Axis.horizontal,
  322. children: [
  323. Expanded(
  324. flex: 1,
  325. child: Container(
  326. decoration: BoxDecoration(
  327. color: ColorUtils.string2Color('#F2F3F6'),
  328. borderRadius: BorderRadius.circular(10),
  329. border: Border.all(color: ColorUtils.string2Color('#F2F3F6'), width: 1),
  330. ),
  331. height: 78,
  332. child: Column(
  333. crossAxisAlignment: CrossAxisAlignment.center,
  334. mainAxisAlignment: MainAxisAlignment.center,
  335. children: [
  336. Text(
  337. '$date3',
  338. style: TextStyle(fontSize: 13.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w400), // 设置字体大小
  339. ),
  340. const MyAssetImage(
  341. Assets.rewardsRewardsIconJb,
  342. width: 23,
  343. height: 23,
  344. ),
  345. Text(
  346. '+2',
  347. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  348. ),
  349. ],
  350. ),
  351. ),
  352. ),
  353. const SizedBox(width: 15.0),
  354. Expanded(
  355. flex: 1,
  356. child: Container(
  357. decoration: BoxDecoration(
  358. color: ColorUtils.string2Color('#F2F3F6'),
  359. borderRadius: BorderRadius.circular(10),
  360. border: Border.all(color: ColorUtils.string2Color('#F2F3F6'), width: 1),
  361. ),
  362. height: 78,
  363. child: Column(
  364. crossAxisAlignment: CrossAxisAlignment.center,
  365. mainAxisAlignment: MainAxisAlignment.center,
  366. children: [
  367. Text(
  368. '$date4',
  369. style: TextStyle(fontSize: 13.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w400), // 设置字体大小
  370. ),
  371. const MyAssetImage(
  372. Assets.rewardsRewardsIconJb,
  373. width: 23,
  374. height: 23,
  375. ),
  376. Text(
  377. '+2',
  378. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  379. ),
  380. ],
  381. ),
  382. ),
  383. ),
  384. const SizedBox(width: 15.0),
  385. Expanded(
  386. flex: 2,
  387. child: Container(
  388. decoration: BoxDecoration(
  389. color: ColorUtils.string2Color('#F2F3F6'),
  390. borderRadius: BorderRadius.circular(10),
  391. border: Border.all(color: ColorUtils.string2Color('#F2F3F6'), width: 1),
  392. ),
  393. height: 78,
  394. child: Row(
  395. crossAxisAlignment: CrossAxisAlignment.start,
  396. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  397. children: [
  398. Column(
  399. crossAxisAlignment: CrossAxisAlignment.center,
  400. // mainAxisAlignment: MainAxisAlignment.center,
  401. children: [
  402. Text(
  403. '$date5',
  404. style: TextStyle(fontSize: 13.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w400), // 设置字体大小
  405. ),
  406. Text(
  407. '+ More',
  408. style: TextStyle(fontSize: 12.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  409. ),
  410. ],
  411. ),
  412. const MyAssetImage(
  413. Assets.rewardsRewardsIconYdjb,
  414. width: 67,
  415. height: 57,
  416. ).paddingOnly(top: 7),
  417. ],
  418. ).paddingOnly(top: 8, left: 13, right: 4),
  419. ),
  420. ),
  421. ],
  422. ),
  423. ],
  424. ).paddingOnly(left: 15, right: 15, top: 15, bottom: 15),
  425. );
  426. }
  427. Widget _buildSwiper(BuildContext context, WidgetRef ref, _vm, RewardsIndexEntity? list) {
  428. int points = list?.points ?? 0;
  429. return Container(
  430. // color: Colors.white,
  431. height: 55,
  432. decoration: BoxDecoration(
  433. color: Colors.white,
  434. borderRadius: BorderRadius.circular(10),
  435. boxShadow: const [BoxShadow(color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)],
  436. ),
  437. child: Row(
  438. crossAxisAlignment: CrossAxisAlignment.center,
  439. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  440. children: [
  441. Text(
  442. S.current.how_to_get_rewards,
  443. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  444. ),
  445. Container(
  446. padding: const EdgeInsets.only(top: 10, bottom: 10, left: 17, right: 17),
  447. decoration: BoxDecoration(
  448. color: ColorUtils.string2Color('#4161D0'),
  449. borderRadius: BorderRadius.circular(5),
  450. ),
  451. child: Text(
  452. S.current.rewards,
  453. style: TextStyle(fontSize: 14.0, color: ColorUtils.string2Color('#ffffff'), fontWeight: FontWeight.w400), // 设置字体大小
  454. ).onTap(() {
  455. RewardsHomePage.startInstance(points: points);
  456. }),
  457. ),
  458. ],
  459. ).paddingOnly(left: 15, right: 15),
  460. ).marginOnly(top: 12, bottom: 12);
  461. }
  462. Widget _buildList(BuildContext context, WidgetRef ref, _vm, RewardsIndexEntity? list) {
  463. bool newsFeed = list?.tasks?.newsFeedPost ?? false;
  464. int giveLikes = list?.tasks?.give10Likes ?? 0;
  465. return Container(
  466. decoration: BoxDecoration(
  467. color: Colors.white,
  468. borderRadius: BorderRadius.circular(10),
  469. boxShadow: const [BoxShadow(color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)],
  470. ),
  471. child: Column(
  472. crossAxisAlignment: CrossAxisAlignment.center,
  473. mainAxisAlignment: MainAxisAlignment.center,
  474. children: [
  475. Container(
  476. padding: const EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15),
  477. decoration: BoxDecoration(
  478. border: Border(
  479. bottom: BorderSide(
  480. width: 1.0, // 底边边框的宽度
  481. color: ColorUtils.string2Color('#F2F3F6'), // 底边边框的颜色
  482. ))),
  483. child: Row(
  484. crossAxisAlignment: CrossAxisAlignment.center,
  485. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  486. children: [
  487. Row(
  488. children: [
  489. Container(
  490. padding: const EdgeInsets.only(top: 10, bottom: 10, left: 17, right: 17),
  491. decoration: BoxDecoration(
  492. color: ColorUtils.string2Color('#f2f3f6'),
  493. borderRadius: BorderRadius.circular(5),
  494. ),
  495. child: const MyAssetImage(
  496. Assets.rewardsRewardsIconIm,
  497. width: 29,
  498. height: 24,
  499. ),
  500. ).marginOnly(right: 12),
  501. Column(
  502. crossAxisAlignment: CrossAxisAlignment.start,
  503. mainAxisAlignment: MainAxisAlignment.center,
  504. children: [
  505. Text(
  506. S.current.daily_login,
  507. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  508. ).marginOnly(bottom: 6),
  509. Row(
  510. children: [
  511. Text(
  512. '+2',
  513. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#4161D0'), fontWeight: FontWeight.w500), // 设置字体大小
  514. ),
  515. const MyAssetImage(
  516. Assets.rewardsRewardsIconJb,
  517. width: 14,
  518. height: 14,
  519. ).marginOnly(left: 3)
  520. ],
  521. )
  522. ],
  523. )
  524. ],
  525. ),
  526. Container(
  527. width: 86,
  528. height: 30,
  529. decoration: BoxDecoration(
  530. color: ColorUtils.string2Color('#ffffff'),
  531. borderRadius: BorderRadius.circular(5),
  532. border: Border.all(color: ColorUtils.string2Color('#4161D0'), width: 1),
  533. ),
  534. child: Center(
  535. child: Text(
  536. S.current.check_in,
  537. style: TextStyle(fontSize: 14.0, color: ColorUtils.string2Color('#4161D0'), fontWeight: FontWeight.w400), // 设置字体大小
  538. ),
  539. ),
  540. ),
  541. ],
  542. ),
  543. ),
  544. Container(
  545. padding: const EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15),
  546. decoration: BoxDecoration(
  547. border: Border(
  548. bottom: BorderSide(
  549. width: 1.0, // 底边边框的宽度
  550. color: ColorUtils.string2Color('#F2F3F6'), // 底边边框的颜色
  551. ))),
  552. child: Row(
  553. crossAxisAlignment: CrossAxisAlignment.center,
  554. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  555. children: [
  556. Row(
  557. children: [
  558. Container(
  559. padding: const EdgeInsets.only(top: 10, bottom: 10, left: 17, right: 17),
  560. decoration: BoxDecoration(
  561. color: ColorUtils.string2Color('#f2f3f6'),
  562. borderRadius: BorderRadius.circular(5),
  563. ),
  564. child: const MyAssetImage(
  565. Assets.rewardsRewardsIconIm,
  566. width: 29,
  567. height: 24,
  568. ),
  569. ).marginOnly(right: 12),
  570. Column(
  571. crossAxisAlignment: CrossAxisAlignment.start,
  572. mainAxisAlignment: MainAxisAlignment.center,
  573. children: [
  574. Text(
  575. S.current.news_feed_post,
  576. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  577. ).marginOnly(bottom: 6),
  578. Row(
  579. children: [
  580. Text(
  581. '+2',
  582. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#4161D0'), fontWeight: FontWeight.w500), // 设置字体大小
  583. ),
  584. const MyAssetImage(
  585. Assets.rewardsRewardsIconJb,
  586. width: 14,
  587. height: 14,
  588. ).marginOnly(left: 3)
  589. ],
  590. )
  591. ],
  592. )
  593. ],
  594. ),
  595. Container(
  596. width: 86,
  597. height: 30,
  598. decoration: BoxDecoration(
  599. color: ColorUtils.string2Color('#ffffff'),
  600. borderRadius: BorderRadius.circular(5),
  601. border: Border.all(color: ColorUtils.string2Color('#4161D0'), width: 1),
  602. ),
  603. child: Center(
  604. child: Text(
  605. newsFeed == true ? S.current.completed : S.current.incomplete,
  606. style: TextStyle(fontSize: 14.0, color: ColorUtils.string2Color('#4161D0'), fontWeight: FontWeight.w400), // 设置字体大小
  607. ),
  608. ),
  609. ),
  610. ],
  611. ),
  612. ),
  613. Container(
  614. padding: const EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15),
  615. decoration: BoxDecoration(
  616. border: Border(
  617. bottom: BorderSide(
  618. width: 1.0, // 底边边框的宽度
  619. color: ColorUtils.string2Color('#F2F3F6'), // 底边边框的颜色
  620. ))),
  621. child: Row(
  622. crossAxisAlignment: CrossAxisAlignment.center,
  623. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  624. children: [
  625. Row(
  626. children: [
  627. Container(
  628. padding: const EdgeInsets.only(top: 10, bottom: 10, left: 17, right: 17),
  629. decoration: BoxDecoration(
  630. color: ColorUtils.string2Color('#f2f3f6'),
  631. borderRadius: BorderRadius.circular(5),
  632. ),
  633. child: const MyAssetImage(
  634. Assets.rewardsRewardsIconIm,
  635. width: 29,
  636. height: 24,
  637. ),
  638. ).marginOnly(right: 12),
  639. Column(
  640. crossAxisAlignment: CrossAxisAlignment.start,
  641. mainAxisAlignment: MainAxisAlignment.center,
  642. children: [
  643. Text(
  644. S.current.give_10_likes,
  645. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  646. ).marginOnly(bottom: 6),
  647. Row(
  648. children: [
  649. Text(
  650. '+2',
  651. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#4161D0'), fontWeight: FontWeight.w500), // 设置字体大小
  652. ),
  653. const MyAssetImage(
  654. Assets.rewardsRewardsIconJb,
  655. width: 14,
  656. height: 14,
  657. ).marginOnly(left: 3)
  658. ],
  659. )
  660. ],
  661. )
  662. ],
  663. ),
  664. Container(
  665. width: 86,
  666. height: 30,
  667. decoration: BoxDecoration(
  668. color: ColorUtils.string2Color('#ffffff'),
  669. borderRadius: BorderRadius.circular(5),
  670. border: Border.all(color: ColorUtils.string2Color('#4161D0'), width: 1),
  671. ),
  672. child: Center(
  673. child: Text(
  674. giveLikes == 10 ? S.current.completed : '$giveLikes/10',
  675. style: TextStyle(fontSize: 14.0, color: ColorUtils.string2Color('#4161D0'), fontWeight: FontWeight.w400), // 设置字体大小
  676. ),
  677. ),
  678. ),
  679. ],
  680. ),
  681. )
  682. ],
  683. ),
  684. ).marginOnly(bottom: 12);
  685. }
  686. Widget _buildHistory(BuildContext context, WidgetRef ref, _vm, RewardsIndexEntity? list) {
  687. List latest = list?.latest ?? [];
  688. Log.d("list是空吗? $list 最近的信息:$latest");
  689. return Container(
  690. decoration: BoxDecoration(
  691. color: Colors.white,
  692. borderRadius: BorderRadius.circular(10),
  693. boxShadow: const [BoxShadow(color: Color.fromRGBO(184, 191, 217, 0.3), blurRadius: 6)],
  694. ),
  695. child: Column(
  696. crossAxisAlignment: CrossAxisAlignment.center,
  697. mainAxisAlignment: MainAxisAlignment.center,
  698. children: [
  699. Row(crossAxisAlignment: CrossAxisAlignment.center, mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [
  700. Text(
  701. S.current.points_history,
  702. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  703. ),
  704. Text(
  705. S.current.more_arrow,
  706. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#4161D0'), fontWeight: FontWeight.w500), // 设置字体大小
  707. ).onTap(() {
  708. RewardsHistoryPage.startInstance();
  709. })
  710. ]).paddingOnly(left: 15, right: 15, top: 15, bottom: 5),
  711. Column(
  712. crossAxisAlignment: CrossAxisAlignment.center,
  713. mainAxisAlignment: MainAxisAlignment.center,
  714. children: List.generate(latest.length, (index) {
  715. int point = latest[index]['point'];
  716. return Container(
  717. padding: const EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15),
  718. decoration: BoxDecoration(
  719. border: Border(
  720. bottom: BorderSide(
  721. width: 1.0, // 底边边框的宽度
  722. color: ColorUtils.string2Color('#F2F3F6'), // 底边边框的颜色
  723. ))),
  724. child: Row(
  725. crossAxisAlignment: CrossAxisAlignment.center,
  726. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  727. children: [
  728. Column(
  729. crossAxisAlignment: CrossAxisAlignment.start,
  730. mainAxisAlignment: MainAxisAlignment.center,
  731. children: [
  732. Text(
  733. latest[index]['short_description'],
  734. style: TextStyle(fontSize: 15.0, color: ColorUtils.string2Color('#000000'), fontWeight: FontWeight.w500), // 设置字体大小
  735. ).marginOnly(bottom: 6),
  736. Text(
  737. latest[index]['created_at'],
  738. style: TextStyle(fontSize: 13.0, color: ColorUtils.string2Color('#808DAF'), fontWeight: FontWeight.w400), // 设置字体大小
  739. ),
  740. ],
  741. ),
  742. Text(
  743. "$point",
  744. style: TextStyle(fontSize: 20.0, color: ColorUtils.string2Color('#FDB429'), fontWeight: FontWeight.w500), // 设置字体大小
  745. ),
  746. ],
  747. ),
  748. );
  749. }))
  750. ],
  751. ),
  752. ).marginOnly(bottom: 12);
  753. }
  754. }