store_page.dart 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  1. import 'package:auto_size_text/auto_size_text.dart';
  2. import 'package:carousel_slider/carousel_slider.dart';
  3. import 'package:flutter/material.dart';
  4. import 'package:flutter_screenutil/flutter_screenutil.dart';
  5. import 'package:get/get.dart';
  6. import 'package:keyboard/base/base_page.dart';
  7. import 'package:keyboard/data/consts/payment_type.dart';
  8. import 'package:keyboard/data/consts/web_url.dart';
  9. import 'package:keyboard/module/store/store_controller.dart';
  10. import 'package:keyboard/module/store/store_user_reviews_bean.dart';
  11. import 'package:keyboard/resource/string.gen.dart';
  12. import 'package:keyboard/widget/platform_util.dart';
  13. import '../../resource/assets.gen.dart';
  14. import '../../router/app_pages.dart';
  15. import '../../utils/date_util.dart';
  16. import '../../widget/horizontal_dashed_line.dart';
  17. import '../../utils/styles.dart';
  18. import '../../widget/click_text_span.dart';
  19. class StorePage extends BasePage<StoreController> {
  20. const StorePage({super.key});
  21. static start() {
  22. Get.toNamed(RoutePath.store);
  23. }
  24. @override
  25. backgroundColor() => const Color(0xFFFFF8D4);
  26. @override
  27. bool immersive() {
  28. return true;
  29. }
  30. @override
  31. Widget buildBody(BuildContext context) {
  32. Widget bottomArea;
  33. if (PlatformUtil.isIOS) {
  34. bottomArea = Column(
  35. children: [
  36. // iOS平台的隐私协议和服务条款
  37. _buildLastBottomCorner(
  38. child: Container(
  39. margin: EdgeInsets.only(left: 16.w),
  40. child: _buildPrivacy(
  41. privacyColor: Color(0x99673300),
  42. mainAxisAlignment: MainAxisAlignment.start,
  43. ),
  44. ),
  45. ),
  46. // 恢复订阅入口
  47. _buildRecoverSubscribe(),
  48. SizedBox(height: 50.h),
  49. ],
  50. );
  51. } else {
  52. // 安卓端,可以有会员心声和购买须知
  53. bottomArea = Column(
  54. children: [
  55. // 产品描述
  56. _buildLastBottomCorner(child: _buildVipDesc()),
  57. SizedBox(height: 32.h),
  58. _buildUserReviews(),
  59. SizedBox(height: 20.h),
  60. _buildUserNotice(),
  61. ],
  62. );
  63. }
  64. return Stack(
  65. children: [
  66. SingleChildScrollView(
  67. child: Column(
  68. children: [
  69. _buildBanner(context),
  70. SizedBox(height: 12.h),
  71. _buildGoodsCard(),
  72. bottomArea,
  73. ],
  74. ),
  75. ),
  76. Positioned(top: 0, left: 0, right: 0, child: _buildTitle()),
  77. Positioned(bottom: 0, left: 0, right: 0, child: _buildBuyButtonCard()),
  78. ],
  79. );
  80. }
  81. _buildTitle() {
  82. return SafeArea(
  83. child: Container(
  84. alignment: Alignment.centerLeft,
  85. padding: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w),
  86. child: Row(
  87. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  88. children: [
  89. GestureDetector(
  90. onTap: controller.clickBack,
  91. child: Assets.images.iconStoreBack.image(
  92. width: 32.w,
  93. height: 32.w,
  94. ),
  95. ),
  96. Obx(() {
  97. return SizedBox(
  98. height: 32.h,
  99. child: Row(
  100. mainAxisSize: MainAxisSize.min,
  101. mainAxisAlignment: MainAxisAlignment.center,
  102. crossAxisAlignment: CrossAxisAlignment.center,
  103. children: [
  104. // 会员状态信息
  105. _buildMemberInfo(),
  106. SizedBox(width: 8.w),
  107. controller.isLogin
  108. ? Assets.images.iconMineUserLogged.image(
  109. width: 28.w,
  110. height: 28.w,
  111. )
  112. : Assets.images.iconMineUserNoLogin.image(
  113. width: 28.w,
  114. height: 28.w,
  115. ),
  116. ],
  117. ),
  118. );
  119. }),
  120. ],
  121. ),
  122. ),
  123. );
  124. }
  125. // 会员信息
  126. Widget _buildMemberInfo() {
  127. return Container(
  128. height: 32.h,
  129. alignment: Alignment.center,
  130. padding: EdgeInsets.symmetric(horizontal: 12.w),
  131. decoration: BoxDecoration(
  132. color: Colors.black.withAlpha(77),
  133. borderRadius: BorderRadius.circular(21.r),
  134. ),
  135. child: Text.rich(
  136. TextSpan(children: _getMemberStatusText()),
  137. textAlign: TextAlign.right,
  138. ),
  139. );
  140. }
  141. // 会员状态文字逻辑提取
  142. List<TextSpan> _getMemberStatusText() {
  143. // 未登录
  144. if (!controller.isLogin) {
  145. return [
  146. TextSpan(
  147. text: StringName.memberNoLogged,
  148. style: _vipTextStyle(isHighlight: true),
  149. ),
  150. TextSpan(text: StringName.memberCardNoVipDesc, style: _vipTextStyle()),
  151. ];
  152. }
  153. final isMember = controller.memberStatusInfo?.isMember ?? false;
  154. final isPermanent = controller.memberStatusInfo?.permanent ?? false;
  155. final username = controller.userInfo?.name ?? '';
  156. if (isMember) {
  157. if (isPermanent) {
  158. return [
  159. TextSpan(
  160. text: StringName.memberCardPermanentVipDesc1,
  161. style: _vipTextStyle(),
  162. ),
  163. TextSpan(
  164. text: StringName.memberCardPermanentVipDesc2,
  165. style: _vipTextStyle(isHighlight: true),
  166. ),
  167. ];
  168. } else {
  169. return [
  170. TextSpan(text: StringName.memberVipDesc, style: _vipTextStyle()),
  171. TextSpan(
  172. text: DateUtil.fromMillisecondsSinceEpoch(
  173. 'yyyy.MM.dd',
  174. controller.memberStatusInfo?.endTimestamp ?? 0,
  175. ),
  176. style: _vipTextStyle(isHighlight: true),
  177. ),
  178. ];
  179. }
  180. }
  181. // 登录但不是会员
  182. return [
  183. TextSpan(
  184. text: controller.userInfo?.name ?? controller.getUserName(),
  185. style: _vipTextStyle(isHighlight: true),
  186. ),
  187. TextSpan(text: StringName.memberCardNoVipDesc, style: _vipTextStyle()),
  188. ];
  189. }
  190. // 统一的会员状态文本样式
  191. TextStyle _vipTextStyle({bool isHighlight = false}) {
  192. return TextStyle(
  193. color: isHighlight ? const Color(0xFFFFD273) : Colors.white,
  194. fontSize: 12.sp,
  195. fontWeight: FontWeight.w400,
  196. );
  197. }
  198. Widget _buildGoodsCard() {
  199. return Container(
  200. margin: EdgeInsets.symmetric(horizontal: 16.w),
  201. padding: EdgeInsets.only(
  202. top: 16.h,
  203. left: 16.w,
  204. right: 16.w,
  205. bottom: 24.h,
  206. ),
  207. decoration: BoxDecoration(
  208. color: Colors.white,
  209. borderRadius: BorderRadius.only(
  210. topLeft: Radius.circular(16.r),
  211. topRight: Radius.circular(16.r),
  212. ),
  213. ),
  214. child: Column(
  215. crossAxisAlignment: CrossAxisAlignment.start,
  216. mainAxisAlignment: MainAxisAlignment.start,
  217. children: [
  218. Assets.images.iconGoodsInfoTitle.image(
  219. width: 115.w,
  220. fit: BoxFit.cover,
  221. ),
  222. SizedBox(height: 16.h),
  223. Obx(() {
  224. return Column(
  225. children:
  226. controller.filteredGoodsList.map((item) {
  227. return Obx(() {
  228. return GestureDetector(
  229. onTap: () => controller.onGoodsItemClick(item),
  230. child: _buildGoodsItem(
  231. item,
  232. controller.selectedGoodsInfoItem?.id == item.id,
  233. ),
  234. );
  235. });
  236. }).toList(),
  237. );
  238. }),
  239. // iOS平台的产品描述
  240. if (PlatformUtil.isIOS) _buildVipDesc(),
  241. // 非iOS平台,才有支付宝支付和微信支付
  242. if (!PlatformUtil.isIOS) _buildPayWayCard(),
  243. ],
  244. ),
  245. );
  246. }
  247. Widget _buildPayWayCard() {
  248. return GestureDetector(
  249. onTap: () => controller.clickPayWaySwitch(),
  250. child: Container(
  251. height: 36.h,
  252. padding: EdgeInsets.symmetric(horizontal: 10.w),
  253. decoration: ShapeDecoration(
  254. shape: RoundedRectangleBorder(
  255. side: BorderSide(width: 1, color: const Color(0xFFECEBE0)),
  256. borderRadius: BorderRadius.circular(10.r),
  257. ),
  258. ),
  259. child: Row(
  260. children: [
  261. Text(
  262. StringName.storePayWay,
  263. style: Styles.getTextStyleBlack204W400(14.sp),
  264. ),
  265. const Spacer(),
  266. Obx(() {
  267. if (controller.selectedPayWay == null) {
  268. return SizedBox.shrink();
  269. }
  270. return Row(
  271. children: [
  272. Image.asset(
  273. getPaymentIconPath(
  274. payMethod: controller.selectedPayWay!.payMethod,
  275. payPlatform: controller.selectedPayWay!.payPlatform,
  276. ),
  277. width: 20.w,
  278. height: 20.w,
  279. ),
  280. SizedBox(width: 4.w),
  281. Text(
  282. controller.selectedPayWay?.title ?? '',
  283. style: Styles.getTextStyleBlack204W400(14.sp),
  284. ),
  285. SizedBox(width: 6.w),
  286. Assets.images.iconStoreSwitchPay.image(
  287. width: 20.w,
  288. height: 20.w,
  289. fit: BoxFit.fill,
  290. ),
  291. ],
  292. );
  293. }),
  294. ],
  295. ),
  296. ),
  297. );
  298. }
  299. Widget _buildGoodsItem(item, bool isSelected) {
  300. return Container(
  301. margin: EdgeInsets.only(bottom: 8.h),
  302. width: 296.w,
  303. height: 70.h,
  304. decoration: ShapeDecoration(
  305. gradient: LinearGradient(
  306. begin: Alignment(0.77, -0.00),
  307. end: Alignment(0.77, 1.00),
  308. colors:
  309. isSelected
  310. ? [const Color(0xFFFF9416), const Color(0xFFFF7813)]
  311. : [const Color(0xFFFEE057), const Color(0xFFFFC400)],
  312. ),
  313. shape: RoundedRectangleBorder(
  314. borderRadius: BorderRadius.circular(10.r),
  315. ),
  316. ),
  317. child: Row(
  318. children: [
  319. Container(
  320. width: 212.w,
  321. height: 70.h,
  322. decoration: ShapeDecoration(
  323. gradient:
  324. isSelected
  325. ? LinearGradient(
  326. begin: Alignment(-0.06, 0.50),
  327. end: Alignment(1.14, 0.50),
  328. colors: [
  329. const Color(0xFFFFF895),
  330. const Color(0xFFFFE941),
  331. ],
  332. )
  333. : null,
  334. color: isSelected ? null : const Color(0xFFFFFDEE),
  335. shape: RoundedRectangleBorder(
  336. side: BorderSide(width: 1, color: const Color(0xFFFEE86B)),
  337. borderRadius: BorderRadius.circular(isSelected ? 8 : 10.r),
  338. ),
  339. ),
  340. child: Stack(
  341. children: [
  342. if (isSelected)
  343. IgnorePointer(
  344. child: Assets.images.bgStoreSelectedItem.image(
  345. width: 212.w,
  346. height: 70.h,
  347. fit: BoxFit.fill,
  348. ),
  349. ),
  350. Padding(
  351. padding: EdgeInsets.only(left: 16.w),
  352. child: Column(
  353. crossAxisAlignment: CrossAxisAlignment.start,
  354. mainAxisAlignment: MainAxisAlignment.center,
  355. children: [
  356. Row(
  357. children: [
  358. RichText(
  359. text: TextSpan(
  360. children: [
  361. TextSpan(
  362. text: '¥',
  363. style: Styles.getTextStyleFF663300W700(14.sp),
  364. ),
  365. TextSpan(
  366. text: item.priceDescNumber,
  367. style: Styles.getTextStyleFF663300W700(18.sp),
  368. ),
  369. TextSpan(
  370. text: item.priceDescUnit,
  371. style: Styles.getTextStyleFF663300W400(13.sp),
  372. ),
  373. ],
  374. ),
  375. ),
  376. if (item.mostDesc?.isNotEmpty == true)
  377. Container(
  378. constraints: BoxConstraints(
  379. minHeight: 20.w,
  380. maxHeight: 20.w,
  381. minWidth: 40.w,
  382. maxWidth: 120.w,
  383. ),
  384. padding: EdgeInsets.only(
  385. left: 16.w,
  386. top: 2.h,
  387. bottom: 2.h,
  388. right: 4.w,
  389. ),
  390. decoration: BoxDecoration(
  391. image: DecorationImage(
  392. image: Assets.images.iconStoreMost.provider(),
  393. fit: BoxFit.fill,
  394. alignment: Alignment.bottomLeft,
  395. ),
  396. ),
  397. child: AutoSizeText(
  398. item.mostDesc!,
  399. style: TextStyle(
  400. color: Colors.white,
  401. fontSize: 12.sp,
  402. fontWeight: FontWeight.w500,
  403. letterSpacing: -0.60,
  404. ),
  405. maxLines: 1,
  406. overflow: TextOverflow.ellipsis,
  407. minFontSize: 8,
  408. // 最小字体
  409. stepGranularity: 0.5, // 缩小步长,越小越丝滑
  410. ),
  411. ),
  412. ],
  413. ),
  414. Text(
  415. item.description!,
  416. style: Styles.getTextStyle99673300W400(12.sp),
  417. ),
  418. ],
  419. ),
  420. ),
  421. ],
  422. ),
  423. ),
  424. // 右侧
  425. Expanded(
  426. child: Column(
  427. mainAxisAlignment: MainAxisAlignment.center,
  428. crossAxisAlignment: CrossAxisAlignment.center,
  429. children: [
  430. Text(
  431. item.name,
  432. style:
  433. isSelected
  434. ? Styles.getTextStyleFFECBBW500(15.sp)
  435. : Styles.getTextStyleFF663300W500(15.sp),
  436. ),
  437. Container(
  438. padding: EdgeInsets.symmetric(horizontal: 8.w),
  439. decoration: ShapeDecoration(
  440. color: isSelected ? const Color(0xFFFFECBB) : null,
  441. gradient:
  442. isSelected
  443. ? null
  444. : LinearGradient(
  445. begin: Alignment(0.77, -0.00),
  446. end: Alignment(0.77, 1.00),
  447. colors: [
  448. const Color(0xFFFF9416),
  449. const Color(0xFFFF7813),
  450. ],
  451. ),
  452. shape: RoundedRectangleBorder(
  453. borderRadius: BorderRadius.circular(
  454. isSelected ? 17.r : 10.r,
  455. ),
  456. ),
  457. ),
  458. child: Text(
  459. '¥${item.amountText}',
  460. textAlign: TextAlign.center,
  461. style:
  462. isSelected
  463. ? Styles.getTextStyleFF7F14W500(12.sp)
  464. : Styles.getTextStyleWhiteW500(12.sp),
  465. ),
  466. ),
  467. ],
  468. ),
  469. ),
  470. ],
  471. ),
  472. );
  473. }
  474. /// 最后的底部圆角
  475. Widget _buildLastBottomCorner({required Widget child}) {
  476. return Container(
  477. alignment: Alignment.centerLeft,
  478. margin: EdgeInsets.symmetric(horizontal: 16.w),
  479. padding: EdgeInsets.symmetric(horizontal: 16.w),
  480. width: double.infinity,
  481. height: 36.h,
  482. decoration: ShapeDecoration(
  483. gradient: LinearGradient(
  484. begin: Alignment(0.00, 0.50),
  485. end: Alignment(1.00, 0.50),
  486. colors: [const Color(0x7FFFF3A3), const Color(0x21FFF3A3)],
  487. ),
  488. shape: RoundedRectangleBorder(
  489. borderRadius: BorderRadius.only(
  490. bottomLeft: Radius.circular(20.r),
  491. bottomRight: Radius.circular(20.r),
  492. ),
  493. ),
  494. shadows: [
  495. BoxShadow(
  496. color: Colors.black.withAlpha(10),
  497. blurRadius: 10.r,
  498. spreadRadius: 0.r,
  499. offset: Offset(0, 8.r),
  500. ),
  501. ],
  502. ),
  503. child: child,
  504. );
  505. }
  506. /// 产品描述
  507. Widget _buildVipDesc() {
  508. return Obx(() {
  509. return Text(
  510. controller.selectedGoodsInfoItem?.selectDesc ?? "",
  511. style: Styles.getTextStyle99673300W400(12.sp),
  512. );
  513. });
  514. }
  515. // 轮播图
  516. Widget _buildBanner(BuildContext context) {
  517. return SizedBox(
  518. width: double.infinity,
  519. child: Stack(
  520. children: [
  521. CarouselSlider(
  522. carouselController: controller.carouselSliderController,
  523. options: CarouselOptions(
  524. height: 280.h,
  525. viewportFraction: 1,
  526. initialPage: 0,
  527. enableInfiniteScroll: true,
  528. reverse: false,
  529. autoPlay: true,
  530. autoPlayInterval: const Duration(seconds: 3),
  531. autoPlayAnimationDuration: const Duration(milliseconds: 800),
  532. autoPlayCurve: Curves.fastOutSlowIn,
  533. scrollDirection: Axis.horizontal,
  534. onPageChanged: (index, reason) {
  535. controller.onBannerChanged(index, reason);
  536. },
  537. ),
  538. items:
  539. controller.bannerList.map((item) {
  540. return item.banner.image(
  541. width: double.infinity,
  542. fit: BoxFit.cover,
  543. );
  544. }).toList(),
  545. ),
  546. Positioned(bottom: 0, left: 0, right: 0, child: _buildIndicator()),
  547. ],
  548. ),
  549. );
  550. }
  551. // 指示器
  552. _buildIndicator() {
  553. return Container(
  554. height: 36.h,
  555. margin: EdgeInsets.symmetric(horizontal: 16.w),
  556. decoration: ShapeDecoration(
  557. color: const Color(0xE5121212),
  558. shape: RoundedRectangleBorder(
  559. borderRadius: BorderRadius.circular(21.r),
  560. ),
  561. ),
  562. child: Row(
  563. mainAxisAlignment: MainAxisAlignment.spaceAround,
  564. children:
  565. controller.bannerList.asMap().entries.map((entry) {
  566. return Obx(() {
  567. final isSelectedBanner =
  568. controller.currentBannerIndex == entry.key;
  569. return Row(
  570. mainAxisAlignment: MainAxisAlignment.spaceAround,
  571. children: [
  572. GestureDetector(
  573. onTap:
  574. () => controller.carouselSliderController
  575. .animateToPage(entry.key),
  576. child: SizedBox(
  577. width: 100.w,
  578. child: Stack(
  579. alignment: Alignment.center,
  580. clipBehavior: Clip.none,
  581. children: [
  582. if (isSelectedBanner)
  583. Positioned(
  584. top: -8.h,
  585. child: controller
  586. .bannerList[entry.key]
  587. .indicatorImg
  588. .image(
  589. width: 100.w,
  590. height: 40.h,
  591. fit: BoxFit.fill,
  592. ),
  593. )
  594. else
  595. Text(
  596. controller.bannerList[entry.key].unSelectedDesc,
  597. style: Styles.getTextStyleWhiteW400(14.sp),
  598. ),
  599. ],
  600. ),
  601. ),
  602. ),
  603. if (entry.key != controller.bannerList.length - 1)
  604. Padding(
  605. padding: EdgeInsets.only(left: 4.w),
  606. child: Assets.images.iconStoreDivider.image(
  607. width: 2.w,
  608. height: 17.h,
  609. fit: BoxFit.fill,
  610. ),
  611. ),
  612. ],
  613. );
  614. });
  615. }).toList(),
  616. ),
  617. );
  618. }
  619. Widget _buildUserReviews() {
  620. return Container(
  621. width: double.infinity,
  622. child: Column(
  623. crossAxisAlignment: CrossAxisAlignment.center,
  624. children: [
  625. Assets.images.iconStoreUserReviewsTitle.image(
  626. width: 240.w,
  627. fit: BoxFit.cover,
  628. ),
  629. SizedBox(height: 16.h),
  630. Container(
  631. width: double.infinity,
  632. decoration: BoxDecoration(
  633. borderRadius: BorderRadius.circular(19.r),
  634. gradient: LinearGradient(
  635. begin: Alignment.topCenter,
  636. end: Alignment.bottomCenter,
  637. colors: [Colors.white, Color(0xfffff8d4)],
  638. ),
  639. ),
  640. child: Column(
  641. children: [
  642. SizedBox(height: 20.h),
  643. Container(
  644. width: 326.w,
  645. decoration: BoxDecoration(
  646. borderRadius: BorderRadius.circular(19.r),
  647. image: DecorationImage(
  648. alignment: Alignment.topCenter,
  649. image: Assets.images.bgStoreUserReviews.provider(),
  650. fit: BoxFit.contain,
  651. ),
  652. ),
  653. child: Column(
  654. children: [
  655. Container(
  656. padding: EdgeInsets.only(left: 16.w),
  657. alignment: Alignment.centerLeft,
  658. height: 39.h,
  659. child: Assets.images.iconStoreUserReviewsLogo.image(
  660. width: 92.w,
  661. height: 24.h,
  662. ),
  663. ),
  664. Container(
  665. width: 326.w,
  666. decoration: ShapeDecoration(
  667. color: Colors.white,
  668. shape: RoundedRectangleBorder(
  669. borderRadius: BorderRadius.circular(16.r),
  670. ),
  671. shadows: [
  672. BoxShadow(
  673. color: Colors.black.withAlpha(10),
  674. blurRadius: 10.r,
  675. spreadRadius: 0.r,
  676. offset: Offset(0, 5.r),
  677. ),
  678. ],
  679. ),
  680. child: Column(
  681. children:
  682. controller.userReviewsList.map((item) {
  683. return _buildReviewsItem(item);
  684. }).toList(),
  685. ),
  686. ),
  687. ],
  688. ),
  689. ),
  690. ],
  691. ),
  692. ),
  693. ],
  694. ),
  695. );
  696. }
  697. Widget _buildReviewsItem(StoreUserReviewsBean item) {
  698. return Container(
  699. padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 12.h),
  700. child: Column(
  701. crossAxisAlignment: CrossAxisAlignment.start,
  702. children: [
  703. Row(
  704. children: [
  705. item.avatar.image(width: 28.w, height: 28.h, fit: BoxFit.cover),
  706. SizedBox(width: 10.w),
  707. Text(
  708. item.userName,
  709. style: Styles.getTextStyleBlack204W500(14.sp),
  710. ),
  711. SizedBox(width: 6.w),
  712. Assets.images.iconStorePermanentMember.image(
  713. width: 70.w,
  714. height: 20.h,
  715. fit: BoxFit.cover,
  716. ),
  717. ],
  718. ),
  719. SizedBox(height: 4.h),
  720. Padding(
  721. padding: EdgeInsets.only(left: 38.w),
  722. child: Text(
  723. item.userReviews,
  724. style: TextStyle(
  725. color: Colors.black.withAlpha(153),
  726. fontSize: 12.sp,
  727. fontWeight: FontWeight.w400,
  728. ),
  729. ),
  730. ),
  731. SizedBox(height: 12.h),
  732. if (controller.userReviewsList.indexOf(item) !=
  733. controller.userReviewsList.length - 1)
  734. HorizontalDashedLine(
  735. width: 304.w,
  736. color: const Color(0XFFEDEBE1),
  737. strokeWidth: 2.h,
  738. dashLength: 4.w,
  739. dashSpace: 4.w,
  740. ),
  741. ],
  742. ),
  743. );
  744. }
  745. // 用户须知
  746. Widget _buildUserNotice() {
  747. return Container(
  748. margin: EdgeInsets.symmetric(horizontal: 16.w),
  749. decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.r)),
  750. child: Column(
  751. crossAxisAlignment: CrossAxisAlignment.start,
  752. children: [
  753. Text('购买须知', style: Styles.getTextStyleFF663300W400(12.sp)),
  754. SizedBox(height: 8.h),
  755. Text(
  756. "1.会员权益将在购买成功后自动生效,如遇延迟,请耐心等待5-10分钟。若长时间未生效,请联系客服处理;\n"
  757. "2.本服务为虚拟商品,一经购买成功即视为使用,恕不支持退款或转让,感谢您的理解;\n"
  758. "3.您的支持是我们持续优化与服务的动力,我们将竭诚为您提供更好的体验;\n"
  759. "4.相关细则以《会员服务协议》为准,在法律允许范围内,我们保留最终解释权。开通即视为同意协议条款,请谨慎购买。\n"
  760. "如有疑问,欢迎随时咨询在线客服!",
  761. style: Styles.getTextStyle99673300W400(10.sp),
  762. ),
  763. SizedBox(height: 150.h),
  764. ],
  765. ),
  766. );
  767. }
  768. /// 恢复订阅
  769. Widget _buildRecoverSubscribe() {
  770. return Container(
  771. margin: EdgeInsets.only(left: 16.w, top: 8.h, right: 16.w),
  772. child: Row(
  773. children: [
  774. Text(
  775. "⚠️ 订阅未生效?点此试试",
  776. style: TextStyle(
  777. color: Color(0xFF666355),
  778. fontSize: 13.sp,
  779. fontWeight: FontWeight.w400,
  780. ),
  781. ),
  782. GestureDetector(
  783. onTap: () {
  784. // 恢复订阅
  785. controller.clickRecoverSubscribe();
  786. },
  787. child: Text(
  788. " 恢复订阅>",
  789. style: TextStyle(
  790. color: Color(0xFF479DF7),
  791. fontSize: 13.sp,
  792. fontWeight: FontWeight.w400,
  793. ),
  794. ),
  795. ),
  796. ],
  797. ),
  798. );
  799. }
  800. Widget _buildBuyButtonCard() {
  801. return Container(
  802. width: 360.w,
  803. padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 11.h),
  804. decoration: ShapeDecoration(
  805. color: Colors.white,
  806. shape: RoundedRectangleBorder(
  807. borderRadius: BorderRadius.only(
  808. topLeft: Radius.circular(24.r),
  809. topRight: Radius.circular(24.r),
  810. ),
  811. ),
  812. shadows: [
  813. BoxShadow(
  814. color: Color(0x99FFE498),
  815. blurRadius: 20,
  816. offset: Offset(0, 0),
  817. spreadRadius: 0,
  818. ),
  819. ],
  820. ),
  821. child: Column(
  822. children: [
  823. GestureDetector(
  824. onTap: controller.clickPayNow,
  825. child: Container(
  826. alignment: Alignment.topCenter,
  827. width: 328.w,
  828. height: 56.w,
  829. decoration: ShapeDecoration(
  830. color: const Color(0xFFFFF587),
  831. shape: RoundedRectangleBorder(
  832. borderRadius: BorderRadius.circular(30.55.r),
  833. ),
  834. ),
  835. child: Container(
  836. width: 328.w,
  837. height: 54.w,
  838. decoration: ShapeDecoration(
  839. gradient: LinearGradient(
  840. begin: Alignment(0.60, -0.39),
  841. end: Alignment(0.60, 0.95),
  842. colors: [
  843. const Color(0xFFF95FAC),
  844. const Color(0xFFFD5E4D),
  845. const Color(0xFFFD5E4D),
  846. const Color(0xFFFB8A3C),
  847. ],
  848. ),
  849. shape: RoundedRectangleBorder(
  850. borderRadius: BorderRadius.circular(30.55.r),
  851. ),
  852. ),
  853. child: Center(
  854. child: Text(
  855. StringName.storePayNow,
  856. style: Styles.getTextStyleWhiteW500(17.sp),
  857. ),
  858. ),
  859. ),
  860. ),
  861. ),
  862. // 安卓平台的隐私协议和服务条款
  863. if (!PlatformUtil.isIOS) _buildPrivacy(),
  864. ],
  865. ),
  866. );
  867. }
  868. /// 隐私协议和服务条款
  869. Widget _buildPrivacy({
  870. Color privacyColor = const Color(0xFF459FFF),
  871. MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
  872. }) {
  873. return Row(
  874. mainAxisAlignment: mainAxisAlignment,
  875. children: [
  876. Obx(() {
  877. return GestureDetector(
  878. behavior: HitTestBehavior.opaque,
  879. onTap: () {
  880. controller.isAgree.value = !controller.isAgree.value;
  881. },
  882. child: Padding(
  883. padding: EdgeInsets.symmetric(vertical: 10.w, horizontal: 10.w),
  884. child:
  885. controller.isAgree.value
  886. ? Assets.images.iconStoreAgreePrivacy.image(
  887. width: 16.w,
  888. height: 16.w,
  889. )
  890. : SizedBox(
  891. child: Container(
  892. padding: EdgeInsets.all(1.w),
  893. width: 16.w,
  894. height: 16.w,
  895. child: Container(
  896. decoration: BoxDecoration(
  897. shape: BoxShape.circle,
  898. border: Border.all(
  899. color: Colors.black.withAlpha(153),
  900. width: 1.w,
  901. ),
  902. ),
  903. ),
  904. ),
  905. ),
  906. ),
  907. );
  908. }),
  909. Transform.translate(
  910. offset: Offset(-10.w, 0),
  911. child: Text.rich(
  912. TextSpan(
  913. children: [
  914. TextSpan(
  915. text: StringName.textSpanIHaveReadAndAgree,
  916. style: TextStyle(
  917. color: Colors.black.withAlpha(153),
  918. fontSize: 10.sp,
  919. fontWeight: FontWeight.w400,
  920. ),
  921. ),
  922. ClickTextSpan(
  923. text: StringName.textSpanPrivacyPolicy,
  924. url: WebUrl.privacyPolicy,
  925. color: privacyColor,
  926. ),
  927. TextSpan(
  928. text: StringName.textSpanAnd,
  929. style: TextStyle(
  930. color: Colors.black.withAlpha(153),
  931. fontSize: 10.sp,
  932. fontWeight: FontWeight.w400,
  933. ),
  934. ),
  935. ClickTextSpan(
  936. text: StringName.textSpanServiceTerms,
  937. url: WebUrl.serviceAgreement,
  938. color: privacyColor,
  939. ),
  940. ],
  941. ),
  942. ),
  943. ),
  944. ],
  945. );
  946. }
  947. }