rewards_page.dart 37 KB

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