rewards_page.dart 33 KB

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