rewards_page.dart 37 KB

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