rewards_page.dart 36 KB

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