rewards_page.dart 39 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959
  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:
  66. MediaQuery.of(context).platformBrightness == Brightness.dark
  67. ? ThemeConfig.systemUiOverlayStyleDarkTheme
  68. : ThemeConfig.systemUiOverlayStyleLightThemeWhite,
  69. actions: [
  70. const MyAssetImage(
  71. Assets.rewardsRewardsIconWen,
  72. width: 20,
  73. height: 20,
  74. ).marginOnly(right: 15).onTap(() {
  75. // 去详情
  76. // _vm.launchURL(url);
  77. GlobalWebPage.startInstance(
  78. context: context,
  79. title: S.current.how_do_i_earn_points,
  80. url: 'https://yyjobs.sg/terms/PointsRules.html');
  81. })
  82. ]),
  83. body: Column(children: [
  84. Expanded(
  85. child: LoadStateLayout(
  86. state: state.loadingState,
  87. errorMessage: state.errorMessage,
  88. errorRetry: () {
  89. _vm.retryRequest();
  90. },
  91. successWidget: SingleChildScrollView(
  92. scrollDirection: Axis.vertical,
  93. physics: const BouncingScrollPhysics(),
  94. clipBehavior: Clip.none,
  95. child: Column(
  96. children: [
  97. _buildTop(context, ref, _vm, list),
  98. Container(
  99. transform: Matrix4.translationValues(0.0, -45.0, 0.0),
  100. child: Column(
  101. children: [
  102. _buildSearch(context, ref, _vm, list),
  103. _buildSwiper(context, ref, _vm, list),
  104. list?.points != 0
  105. ? _buildList(context, ref, _vm, list)
  106. : const SizedBox.shrink(),
  107. _buildHistory(context, ref, _vm, list),
  108. ],
  109. ), // 使用负数margin
  110. ).paddingOnly(left: 15, right: 15),
  111. ],
  112. )),
  113. ),
  114. ),
  115. ]).backgroundColor(context.appColors.backgroundDark),
  116. );
  117. }
  118. Widget _buildTop(
  119. BuildContext context, WidgetRef ref, _vm, RewardsIndexEntity? list) {
  120. int points = list?.points ?? 0;
  121. return Container(
  122. decoration: BoxDecoration(
  123. border: Border(
  124. bottom: BorderSide(
  125. color: context.appColors.btnBgDefault, // 设置bottom边框的颜色
  126. width: 45.0, // 设置bottom边框的宽度
  127. )),
  128. borderRadius: const BorderRadius.only(
  129. topLeft: Radius.circular(0.0),
  130. topRight: Radius.circular(0.0),
  131. bottomLeft: Radius.circular(30.0),
  132. bottomRight: Radius.circular(30.0),
  133. ), // 圆角
  134. ),
  135. child: Column(
  136. crossAxisAlignment: CrossAxisAlignment.start,
  137. children: [
  138. Row(
  139. crossAxisAlignment: CrossAxisAlignment.center,
  140. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  141. children: [
  142. Text(
  143. S.current.available_points,
  144. style: const TextStyle(
  145. fontSize: 17.0,
  146. color: Colors.white,
  147. fontWeight: FontWeight.w500), // 设置字体大小
  148. ),
  149. Container(
  150. decoration: BoxDecoration(
  151. border: Border.all(color: Colors.white, width: 1), // 边框
  152. borderRadius: BorderRadius.circular(8), // 圆角
  153. ),
  154. child: Row(
  155. children: [
  156. const MyAssetImage(
  157. Assets.rewardsRewardsIconJb,
  158. width: 23,
  159. height: 23,
  160. ).marginOnly(right: 5),
  161. Text(
  162. '$points',
  163. style: const TextStyle(
  164. fontSize: 15.0,
  165. color: Colors.white,
  166. fontWeight: FontWeight.w400), // 设置字体大小
  167. ),
  168. ],
  169. ).paddingOnly(left: 10, top: 7, bottom: 7, right: 10),
  170. ),
  171. ],
  172. ).paddingOnly(left: 10, top: 0, bottom: 18),
  173. ],
  174. )
  175. .paddingOnly(top: 15, left: 5, right: 15, bottom: 0)
  176. .border(bottom: 0, color: context.appColors.btnBgDefault)
  177. .backgroundColor(context.appColors.btnBgDefault),
  178. );
  179. }
  180. Widget _buildSearch(
  181. BuildContext context, WidgetRef ref, _vm, RewardsIndexEntity? list) {
  182. final dateFormat = DateFormat('yyyy-MM-dd');
  183. final now = DateFormat('yyyy-MM-dd').format(DateTime.now());
  184. // final date = list.continuous.currentWeekCheckin[0] ?? now;
  185. final date = now;
  186. final date0 = DateFormat('MM-dd')
  187. .format(dateFormat.parse(date).subtract(const Duration(days: 1)));
  188. final date1 = DateFormat('MM-dd')
  189. .format(dateFormat.parse(date).add(const Duration(days: 1)));
  190. final date2 = DateFormat('MM-dd')
  191. .format(dateFormat.parse(date).add(const Duration(days: 2)));
  192. final date3 = DateFormat('MM-dd')
  193. .format(dateFormat.parse(date).add(const Duration(days: 3)));
  194. final date4 = DateFormat('MM-dd')
  195. .format(dateFormat.parse(date).add(const Duration(days: 4)));
  196. final date5 = DateFormat('MM-dd')
  197. .format(dateFormat.parse(date).add(const Duration(days: 5)));
  198. // final nextDate = date.add(Duration(days: 1));
  199. return Container(
  200. width: MediaQuery.of(context).size.width - 30,
  201. decoration: BoxDecoration(
  202. color: context.appColors.whiteBG,
  203. borderRadius: BorderRadius.circular(10),
  204. boxShadow: [BoxShadow(color: context.appColors.itemBGShadow)],
  205. ),
  206. child: Column(
  207. crossAxisAlignment: CrossAxisAlignment.start,
  208. mainAxisAlignment: MainAxisAlignment.center,
  209. children: [
  210. Text(
  211. S.current.continuous_login_8_day,
  212. style: TextStyle(
  213. fontSize: 15.0,
  214. color: context.appColors.textBlack,
  215. fontWeight: FontWeight.w500), // 设置字体大小
  216. ),
  217. Flex(
  218. direction: Axis.horizontal,
  219. children: [
  220. Expanded(
  221. flex: 1,
  222. child: Container(
  223. decoration: BoxDecoration(
  224. color: context.appColors.whiteSecondBG,
  225. borderRadius: BorderRadius.circular(10),
  226. border: Border.all(
  227. color: context.appColors.textPrimary, width: 1),
  228. ),
  229. height: 78,
  230. child: Column(
  231. crossAxisAlignment: CrossAxisAlignment.center,
  232. mainAxisAlignment: MainAxisAlignment.center,
  233. children: [
  234. Text(
  235. date0,
  236. style: TextStyle(
  237. fontSize: 13.0,
  238. color: context.appColors.textPrimary,
  239. fontWeight: FontWeight.w400), // 设置字体大小
  240. ),
  241. const MyAssetImage(
  242. Assets.rewardsRewardsIconJb,
  243. width: 23,
  244. height: 23,
  245. ),
  246. Text(
  247. '+2',
  248. style: TextStyle(
  249. fontSize: 15.0,
  250. color: context.appColors.textPrimary,
  251. fontWeight: FontWeight.w500), // 设置字体大小
  252. ),
  253. ],
  254. ),
  255. ),
  256. ),
  257. const SizedBox(width: 15.0),
  258. Expanded(
  259. flex: 1,
  260. child: Container(
  261. decoration: BoxDecoration(
  262. color: AppColorsTheme.colorPrimary,
  263. borderRadius: BorderRadius.circular(10),
  264. border: Border.all(
  265. color: AppColorsTheme.colorPrimary, width: 1),
  266. ),
  267. height: 78,
  268. child: Column(
  269. crossAxisAlignment: CrossAxisAlignment.center,
  270. mainAxisAlignment: MainAxisAlignment.center,
  271. children: [
  272. Text(
  273. 'Today',
  274. style: TextStyle(
  275. fontSize: 13.0,
  276. color: ColorUtils.string2Color('#ffffff'),
  277. fontWeight: FontWeight.w400), // 设置字体大小
  278. ),
  279. const MyAssetImage(
  280. Assets.rewardsRewardsIconJb,
  281. width: 23,
  282. height: 23,
  283. ),
  284. Text(
  285. '+2',
  286. style: TextStyle(
  287. fontSize: 15.0,
  288. color: ColorUtils.string2Color('#ffffff'),
  289. fontWeight: FontWeight.w500), // 设置字体大小
  290. ),
  291. ],
  292. ),
  293. ),
  294. ),
  295. const SizedBox(width: 15.0),
  296. Expanded(
  297. flex: 1,
  298. child: Container(
  299. decoration: BoxDecoration(
  300. color: ColorUtils.string2Color('#F2F3F6'),
  301. borderRadius: BorderRadius.circular(10),
  302. border: Border.all(
  303. color: ColorUtils.string2Color('#F2F3F6'), width: 1),
  304. ),
  305. height: 78,
  306. child: Column(
  307. crossAxisAlignment: CrossAxisAlignment.center,
  308. mainAxisAlignment: MainAxisAlignment.center,
  309. children: [
  310. Text(
  311. '$date1',
  312. style: TextStyle(
  313. fontSize: 13.0,
  314. color: ColorUtils.string2Color('#000000'),
  315. fontWeight: FontWeight.w400), // 设置字体大小
  316. ),
  317. const MyAssetImage(
  318. Assets.rewardsRewardsIconJb,
  319. width: 23,
  320. height: 23,
  321. ),
  322. Text(
  323. '+2',
  324. style: TextStyle(
  325. fontSize: 15.0,
  326. color: ColorUtils.string2Color('#000000'),
  327. fontWeight: FontWeight.w500), // 设置字体大小
  328. ),
  329. ],
  330. ),
  331. ),
  332. ),
  333. const SizedBox(width: 15.0),
  334. Expanded(
  335. flex: 1,
  336. child: Container(
  337. decoration: BoxDecoration(
  338. color: ColorUtils.string2Color('#F2F3F6'),
  339. borderRadius: BorderRadius.circular(10),
  340. border: Border.all(
  341. color: ColorUtils.string2Color('#F2F3F6'), width: 1),
  342. ),
  343. height: 78,
  344. child: Column(
  345. crossAxisAlignment: CrossAxisAlignment.center,
  346. mainAxisAlignment: MainAxisAlignment.center,
  347. children: [
  348. Text(
  349. '$date2',
  350. style: TextStyle(
  351. fontSize: 13.0,
  352. color: ColorUtils.string2Color('#000000'),
  353. fontWeight: FontWeight.w400), // 设置字体大小
  354. ),
  355. const MyAssetImage(
  356. Assets.rewardsRewardsIconJb,
  357. width: 23,
  358. height: 23,
  359. ),
  360. Text(
  361. '+2',
  362. style: TextStyle(
  363. fontSize: 15.0,
  364. color: ColorUtils.string2Color('#000000'),
  365. fontWeight: FontWeight.w500), // 设置字体大小
  366. ),
  367. ],
  368. ),
  369. ),
  370. ),
  371. ],
  372. ).marginOnly(top: 13, bottom: 13),
  373. Flex(
  374. direction: Axis.horizontal,
  375. children: [
  376. Expanded(
  377. flex: 1,
  378. child: Container(
  379. decoration: BoxDecoration(
  380. color: ColorUtils.string2Color('#F2F3F6'),
  381. borderRadius: BorderRadius.circular(10),
  382. border: Border.all(
  383. color: ColorUtils.string2Color('#F2F3F6'), width: 1),
  384. ),
  385. height: 78,
  386. child: Column(
  387. crossAxisAlignment: CrossAxisAlignment.center,
  388. mainAxisAlignment: MainAxisAlignment.center,
  389. children: [
  390. Text(
  391. '$date3',
  392. style: TextStyle(
  393. fontSize: 13.0,
  394. color: ColorUtils.string2Color('#000000'),
  395. fontWeight: FontWeight.w400), // 设置字体大小
  396. ),
  397. const MyAssetImage(
  398. Assets.rewardsRewardsIconJb,
  399. width: 23,
  400. height: 23,
  401. ),
  402. Text(
  403. '+2',
  404. style: TextStyle(
  405. fontSize: 15.0,
  406. color: ColorUtils.string2Color('#000000'),
  407. fontWeight: FontWeight.w500), // 设置字体大小
  408. ),
  409. ],
  410. ),
  411. ),
  412. ),
  413. const SizedBox(width: 15.0),
  414. Expanded(
  415. flex: 1,
  416. child: Container(
  417. decoration: BoxDecoration(
  418. color: ColorUtils.string2Color('#F2F3F6'),
  419. borderRadius: BorderRadius.circular(10),
  420. border: Border.all(
  421. color: ColorUtils.string2Color('#F2F3F6'), width: 1),
  422. ),
  423. height: 78,
  424. child: Column(
  425. crossAxisAlignment: CrossAxisAlignment.center,
  426. mainAxisAlignment: MainAxisAlignment.center,
  427. children: [
  428. Text(
  429. '$date4',
  430. style: TextStyle(
  431. fontSize: 13.0,
  432. color: ColorUtils.string2Color('#000000'),
  433. fontWeight: FontWeight.w400), // 设置字体大小
  434. ),
  435. const MyAssetImage(
  436. Assets.rewardsRewardsIconJb,
  437. width: 23,
  438. height: 23,
  439. ),
  440. Text(
  441. '+2',
  442. style: TextStyle(
  443. fontSize: 15.0,
  444. color: ColorUtils.string2Color('#000000'),
  445. fontWeight: FontWeight.w500), // 设置字体大小
  446. ),
  447. ],
  448. ),
  449. ),
  450. ),
  451. const SizedBox(width: 15.0),
  452. Expanded(
  453. flex: 2,
  454. child: Container(
  455. decoration: BoxDecoration(
  456. color: ColorUtils.string2Color('#F2F3F6'),
  457. borderRadius: BorderRadius.circular(10),
  458. border: Border.all(
  459. color: ColorUtils.string2Color('#F2F3F6'), width: 1),
  460. ),
  461. height: 78,
  462. child: Row(
  463. crossAxisAlignment: CrossAxisAlignment.start,
  464. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  465. children: [
  466. Column(
  467. crossAxisAlignment: CrossAxisAlignment.center,
  468. // mainAxisAlignment: MainAxisAlignment.center,
  469. children: [
  470. Text(
  471. '$date5',
  472. style: TextStyle(
  473. fontSize: 13.0,
  474. color: ColorUtils.string2Color('#000000'),
  475. fontWeight: FontWeight.w400), // 设置字体大小
  476. ),
  477. Text(
  478. '+ More',
  479. style: TextStyle(
  480. fontSize: 12.0,
  481. color: ColorUtils.string2Color('#000000'),
  482. fontWeight: FontWeight.w500), // 设置字体大小
  483. ),
  484. ],
  485. ),
  486. const MyAssetImage(
  487. Assets.rewardsRewardsIconYdjb,
  488. width: 67,
  489. height: 57,
  490. ).paddingOnly(top: 7),
  491. ],
  492. ).paddingOnly(top: 8, left: 13, right: 4),
  493. ),
  494. ),
  495. ],
  496. ),
  497. ],
  498. ).paddingOnly(left: 15, right: 15, top: 15, bottom: 15),
  499. );
  500. }
  501. Widget _buildSwiper(
  502. BuildContext context, WidgetRef ref, _vm, RewardsIndexEntity? list) {
  503. int points = list?.points ?? 0;
  504. return Container(
  505. // color: Colors.white,
  506. height: 55,
  507. decoration: BoxDecoration(
  508. color: context.appColors.whiteBG,
  509. borderRadius: BorderRadius.circular(10),
  510. boxShadow: [BoxShadow(color: context.appColors.itemBGShadow)],
  511. ),
  512. child: Row(
  513. crossAxisAlignment: CrossAxisAlignment.center,
  514. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  515. children: [
  516. Text(
  517. S.current.how_to_get_rewards,
  518. style: TextStyle(
  519. fontSize: 15.0,
  520. color: context.appColors.textBlack,
  521. fontWeight: FontWeight.w500), // 设置字体大小
  522. ),
  523. Container(
  524. padding:
  525. const EdgeInsets.only(top: 10, bottom: 10, left: 17, right: 17),
  526. decoration: BoxDecoration(
  527. color: context.appColors.btnBgDefaultDark,
  528. borderRadius: BorderRadius.circular(5),
  529. ),
  530. child: Text(
  531. S.current.rewards,
  532. style: TextStyle(
  533. fontSize: 14.0,
  534. color: ColorUtils.string2Color('#ffffff'),
  535. fontWeight: FontWeight.w400), // 设置字体大小
  536. ).onTap(() {
  537. RewardsHomePage.startInstance(points: points);
  538. }),
  539. ),
  540. ],
  541. ).paddingOnly(left: 15, right: 15),
  542. ).marginOnly(top: 12, bottom: 12);
  543. }
  544. Widget _buildList(
  545. BuildContext context, WidgetRef ref, _vm, RewardsIndexEntity? list) {
  546. bool newsFeed = list?.tasks?.newsFeedPost ?? false;
  547. int giveLikes = list?.tasks?.give10Likes ?? 0;
  548. final viewModel = ref.watch(rewardsVmProvider.notifier);
  549. return Container(
  550. decoration: BoxDecoration(
  551. color: context.appColors.whiteBG,
  552. borderRadius: BorderRadius.circular(10),
  553. boxShadow: [BoxShadow(color: context.appColors.itemBGShadow)],
  554. ),
  555. child: Column(
  556. crossAxisAlignment: CrossAxisAlignment.center,
  557. mainAxisAlignment: MainAxisAlignment.center,
  558. children: [
  559. Container(
  560. padding:
  561. const EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15),
  562. decoration: BoxDecoration(
  563. border: Border(
  564. bottom: BorderSide(
  565. width: 1.0, // 底边边框的宽度
  566. color: context.appColors.backgroundDark, // 底边边框的颜色
  567. ))),
  568. child: Row(
  569. crossAxisAlignment: CrossAxisAlignment.center,
  570. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  571. children: [
  572. Row(
  573. children: [
  574. Container(
  575. padding: const EdgeInsets.only(
  576. top: 10, bottom: 10, left: 17, right: 17),
  577. decoration: BoxDecoration(
  578. color: ColorUtils.string2Color('#f2f3f6'),
  579. borderRadius: BorderRadius.circular(5),
  580. ),
  581. child: const MyAssetImage(
  582. Assets.rewardsRewardsIconIm,
  583. width: 29,
  584. height: 24,
  585. ),
  586. ).marginOnly(right: 12),
  587. Column(
  588. crossAxisAlignment: CrossAxisAlignment.start,
  589. mainAxisAlignment: MainAxisAlignment.center,
  590. children: [
  591. Text(
  592. S.current.daily_login,
  593. style: TextStyle(
  594. fontSize: 15.0,
  595. color: context.appColors.textBlack,
  596. fontWeight: FontWeight.w500), // 设置字体大小
  597. ).marginOnly(bottom: 6),
  598. Row(
  599. children: [
  600. Text(
  601. '+2',
  602. style: TextStyle(
  603. fontSize: 15.0,
  604. color: context.appColors.textPrimary,
  605. fontWeight: FontWeight.w500), // 设置字体大小
  606. ),
  607. const MyAssetImage(
  608. Assets.rewardsRewardsIconJb,
  609. width: 14,
  610. height: 14,
  611. ).marginOnly(left: 3)
  612. ],
  613. )
  614. ],
  615. )
  616. ],
  617. ),
  618. Container(
  619. width: 86,
  620. height: 30,
  621. decoration: BoxDecoration(
  622. color: Colors.transparent,
  623. borderRadius: BorderRadius.circular(5),
  624. border: Border.all(
  625. color: context.appColors.disEnableGray, width: 1),
  626. ),
  627. child: Center(
  628. child: Text(
  629. // S.current.check_in,
  630. S.current.completed,
  631. style: TextStyle(
  632. fontSize: 14.0,
  633. color: context.appColors.disEnableGray,
  634. fontWeight: FontWeight.w400), // 设置字体大小
  635. ),
  636. ),
  637. ),
  638. ],
  639. ),
  640. ),
  641. Container(
  642. padding:
  643. const EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15),
  644. decoration: BoxDecoration(
  645. border: Border(
  646. bottom: BorderSide(
  647. width: 1.0, // 底边边框的宽度
  648. color: context.appColors.backgroundDark, // 底边边框的颜色
  649. ))),
  650. child: Row(
  651. crossAxisAlignment: CrossAxisAlignment.center,
  652. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  653. children: [
  654. Row(
  655. children: [
  656. Container(
  657. padding: const EdgeInsets.only(
  658. top: 10, bottom: 10, left: 17, right: 17),
  659. decoration: BoxDecoration(
  660. color: ColorUtils.string2Color('#f2f3f6'),
  661. borderRadius: BorderRadius.circular(5),
  662. ),
  663. child: const MyAssetImage(
  664. Assets.rewardsRewardsIconIm,
  665. width: 29,
  666. height: 24,
  667. ),
  668. ).marginOnly(right: 12),
  669. Column(
  670. crossAxisAlignment: CrossAxisAlignment.start,
  671. mainAxisAlignment: MainAxisAlignment.center,
  672. children: [
  673. Text(
  674. S.current.news_feed_post,
  675. style: TextStyle(
  676. fontSize: 15.0,
  677. color: context.appColors.textBlack,
  678. fontWeight: FontWeight.w500), // 设置字体大小
  679. ).marginOnly(bottom: 6),
  680. Row(
  681. children: [
  682. Text(
  683. '+2',
  684. style: TextStyle(
  685. fontSize: 15.0,
  686. color: context.appColors.textPrimary,
  687. fontWeight: FontWeight.w500), // 设置字体大小
  688. ),
  689. const MyAssetImage(
  690. Assets.rewardsRewardsIconJb,
  691. width: 14,
  692. height: 14,
  693. ).marginOnly(left: 3)
  694. ],
  695. )
  696. ],
  697. )
  698. ],
  699. ),
  700. newsFeed == true
  701. ? Container(
  702. width: 86,
  703. height: 30,
  704. decoration: BoxDecoration(
  705. color: Colors.transparent,
  706. borderRadius: BorderRadius.circular(5),
  707. border: Border.all(
  708. color: context.appColors.disEnableGray, width: 1),
  709. ),
  710. child: Center(
  711. child: Text(
  712. S.current.completed,
  713. style: TextStyle(
  714. fontSize: 14.0,
  715. color: context.appColors.disEnableGray,
  716. fontWeight: FontWeight.w400), // 设置字体大小
  717. ),
  718. ),
  719. )
  720. : Container(
  721. width: 86,
  722. height: 30,
  723. decoration: BoxDecoration(
  724. color: Colors.transparent,
  725. borderRadius: BorderRadius.circular(5),
  726. border: Border.all(
  727. color: context.appColors.btnBgDefaultDark,
  728. width: 1),
  729. ),
  730. child: Center(
  731. child: Text(
  732. S.current.incomplete,
  733. style: TextStyle(
  734. fontSize: 14.0,
  735. color: context.appColors.textPrimary,
  736. fontWeight: FontWeight.w400), // 设置字体大小
  737. ),
  738. ),
  739. ).onTap(() {
  740. viewModel.gotoCommunityPage();
  741. }),
  742. ],
  743. ),
  744. ),
  745. Container(
  746. padding:
  747. const EdgeInsets.only(top: 15, bottom: 15, left: 15, right: 15),
  748. decoration: BoxDecoration(
  749. border: Border(
  750. bottom: BorderSide(
  751. width: 1.0, // 底边边框的宽度
  752. color: context.appColors.backgroundDark, // 底边边框的颜色
  753. ))),
  754. child: Row(
  755. crossAxisAlignment: CrossAxisAlignment.center,
  756. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  757. children: [
  758. Row(
  759. children: [
  760. Container(
  761. padding: const EdgeInsets.only(
  762. top: 10, bottom: 10, left: 17, right: 17),
  763. decoration: BoxDecoration(
  764. color: ColorUtils.string2Color('#f2f3f6'),
  765. borderRadius: BorderRadius.circular(5),
  766. ),
  767. child: const MyAssetImage(
  768. Assets.rewardsRewardsIconIm,
  769. width: 29,
  770. height: 24,
  771. ),
  772. ).marginOnly(right: 12),
  773. Column(
  774. crossAxisAlignment: CrossAxisAlignment.start,
  775. mainAxisAlignment: MainAxisAlignment.center,
  776. children: [
  777. Text(
  778. S.current.give_10_likes,
  779. style: TextStyle(
  780. fontSize: 15.0,
  781. color: context.appColors.textBlack,
  782. fontWeight: FontWeight.w500), // 设置字体大小
  783. ).marginOnly(bottom: 6),
  784. Row(
  785. children: [
  786. Text(
  787. '+2',
  788. style: TextStyle(
  789. fontSize: 15.0,
  790. color: context.appColors.textPrimary,
  791. fontWeight: FontWeight.w500), // 设置字体大小
  792. ),
  793. const MyAssetImage(
  794. Assets.rewardsRewardsIconJb,
  795. width: 14,
  796. height: 14,
  797. ).marginOnly(left: 3)
  798. ],
  799. )
  800. ],
  801. )
  802. ],
  803. ),
  804. giveLikes == 10
  805. ? Container(
  806. width: 86,
  807. height: 30,
  808. decoration: BoxDecoration(
  809. color: Colors.transparent,
  810. borderRadius: BorderRadius.circular(5),
  811. border: Border.all(
  812. color: context.appColors.disEnableGray, width: 1),
  813. ),
  814. child: Center(
  815. child: Text(
  816. S.current.completed,
  817. style: TextStyle(
  818. fontSize: 14.0,
  819. color: context.appColors.disEnableGray,
  820. fontWeight: FontWeight.w400), // 设置字体大小
  821. ),
  822. ),
  823. )
  824. : Container(
  825. width: 86,
  826. height: 30,
  827. decoration: BoxDecoration(
  828. color: Colors.transparent,
  829. borderRadius: BorderRadius.circular(5),
  830. border: Border.all(
  831. color: context.appColors.btnBgDefaultDark,
  832. width: 1),
  833. ),
  834. child: Center(
  835. child: Text(
  836. '$giveLikes/10',
  837. style: TextStyle(
  838. fontSize: 14.0,
  839. color: context.appColors.textPrimary,
  840. fontWeight: FontWeight.w400), // 设置字体大小
  841. ),
  842. ),
  843. ).onTap(() {
  844. viewModel.gotoCommunityPage();
  845. }),
  846. ],
  847. ),
  848. )
  849. ],
  850. ),
  851. ).marginOnly(bottom: 12);
  852. }
  853. Widget _buildHistory(
  854. BuildContext context, WidgetRef ref, _vm, RewardsIndexEntity? list) {
  855. List latest = list?.latest ?? [];
  856. return Container(
  857. decoration: BoxDecoration(
  858. color: context.appColors.whiteBG,
  859. borderRadius: BorderRadius.circular(10),
  860. boxShadow: [BoxShadow(color: context.appColors.itemBGShadow)],
  861. ),
  862. child: Column(
  863. crossAxisAlignment: CrossAxisAlignment.center,
  864. mainAxisAlignment: MainAxisAlignment.center,
  865. children: [
  866. Row(
  867. crossAxisAlignment: CrossAxisAlignment.center,
  868. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  869. children: [
  870. Text(
  871. S.current.points_history,
  872. style: TextStyle(
  873. fontSize: 15.0,
  874. color: context.appColors.textBlack,
  875. fontWeight: FontWeight.w500), // 设置字体大小
  876. ),
  877. Text(
  878. S.current.more_arrow,
  879. style: TextStyle(
  880. fontSize: 15.0,
  881. color: context.appColors.textPrimary,
  882. fontWeight: FontWeight.w500), // 设置字体大小
  883. ).onTap(() {
  884. RewardsHistoryPage.startInstance();
  885. })
  886. ]).paddingOnly(left: 15, right: 15, top: 15, bottom: 5),
  887. Column(
  888. crossAxisAlignment: CrossAxisAlignment.center,
  889. mainAxisAlignment: MainAxisAlignment.center,
  890. children: List.generate(latest.length, (index) {
  891. int point = latest[index]['point'];
  892. return Container(
  893. padding: const EdgeInsets.only(
  894. top: 15, bottom: 15, left: 15, right: 15),
  895. decoration: BoxDecoration(
  896. border: Border(
  897. bottom: BorderSide(
  898. width: 1.0, // 底边边框的宽度
  899. color: context.appColors.backgroundDark, // 底边边框的颜色
  900. ))),
  901. child: Row(
  902. crossAxisAlignment: CrossAxisAlignment.center,
  903. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  904. children: [
  905. Column(
  906. crossAxisAlignment: CrossAxisAlignment.start,
  907. mainAxisAlignment: MainAxisAlignment.center,
  908. children: [
  909. Text(
  910. latest[index]['short_description'],
  911. style: TextStyle(
  912. fontSize: 15.0,
  913. color: context.appColors.textBlack,
  914. fontWeight: FontWeight.w500), // 设置字体大小
  915. ).marginOnly(bottom: 6),
  916. Text(
  917. latest[index]['created_at'],
  918. style: TextStyle(
  919. fontSize: 13.0,
  920. color: DarkThemeUtil.multiColors(
  921. context, ColorUtils.string2Color('#808DAF'),
  922. darkColor: Colors.white),
  923. fontWeight: FontWeight.w400), // 设置字体大小
  924. ),
  925. ],
  926. ),
  927. Text(
  928. "$point",
  929. style: TextStyle(
  930. fontSize: 20.0,
  931. color: DarkThemeUtil.multiColors(
  932. context, ColorUtils.string2Color('#FDB429'),
  933. darkColor: Colors.white),
  934. fontWeight: FontWeight.w500), // 设置字体大小
  935. ),
  936. ],
  937. ),
  938. );
  939. }))
  940. ],
  941. ),
  942. ).marginOnly(bottom: 12);
  943. }
  944. }