store_page.dart 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377
  1. import 'package:auto_size_text/auto_size_text.dart';
  2. import 'package:carousel_slider/carousel_slider.dart';
  3. import 'package:collection/collection.dart';
  4. import 'package:flutter/material.dart';
  5. import 'package:flutter_screenutil/flutter_screenutil.dart';
  6. import 'package:get/get.dart';
  7. import 'package:keyboard/base/base_page.dart';
  8. import 'package:keyboard/data/consts/payment_type.dart';
  9. import 'package:keyboard/data/consts/web_url.dart';
  10. import 'package:keyboard/module/store/store_controller.dart';
  11. import 'package:keyboard/module/store/store_user_reviews_bean.dart';
  12. import 'package:keyboard/resource/string.gen.dart';
  13. import 'package:keyboard/widget/platform_util.dart';
  14. import '../../data/bean/goods_info.dart';
  15. import '../../data/consts/constants.dart';
  16. import '../../resource/assets.gen.dart';
  17. import '../../resource/colors.gen.dart';
  18. import '../../router/app_pages.dart';
  19. import '../../utils/count_down_timer.dart';
  20. import '../../utils/date_util.dart';
  21. import '../../widget/horizontal_dashed_line.dart';
  22. import '../../utils/styles.dart';
  23. import '../../widget/click_text_span.dart';
  24. import '../browser/browser_page.dart';
  25. class StorePage extends BasePage<StoreController> {
  26. const StorePage({super.key});
  27. static start() {
  28. Get.toNamed(RoutePath.store);
  29. }
  30. @override
  31. backgroundColor() => const Color(0xFFFFF8D4);
  32. @override
  33. bool immersive() {
  34. return true;
  35. }
  36. @override
  37. Widget buildBody(BuildContext context) {
  38. Widget bottomArea;
  39. if (PlatformUtil.isIOS) {
  40. bottomArea = Column(
  41. children: [
  42. // iOS平台的隐私协议和服务条款
  43. _buildLastBottomCorner(
  44. child: Container(
  45. // margin: EdgeInsets.only(left: 16.w),
  46. child: _buildPrivacy(
  47. privacyColor: Color(0x99673300),
  48. mainAxisAlignment: MainAxisAlignment.start,
  49. ),
  50. ),
  51. ),
  52. // 恢复订阅入口
  53. _buildRecoverSubscribe(),
  54. SizedBox(height: 20.h),
  55. _buildUserReviews(),
  56. SizedBox(height: 20.h),
  57. _buildUserNotice(),
  58. ],
  59. );
  60. } else {
  61. // 安卓端,可以有会员心声和购买须知
  62. bottomArea = Column(
  63. children: [
  64. // 产品描述
  65. _buildLastBottomCorner(child: _buildVipDesc()),
  66. SizedBox(height: 32.h),
  67. _buildUserReviews(),
  68. SizedBox(height: 20.h),
  69. _buildUserNotice(),
  70. ],
  71. );
  72. }
  73. return Stack(
  74. children: [
  75. SingleChildScrollView(
  76. child: Column(
  77. children: [
  78. _buildBanner(context),
  79. SizedBox(height: 12.h),
  80. _buildGoodsCard(),
  81. bottomArea,
  82. SizedBox(height: 40.h),
  83. ],
  84. ),
  85. Positioned(top: 0, left: 0, right: 0, child: _buildTitle()),
  86. Positioned(
  87. bottom: 0,
  88. left: 0,
  89. right: 0,
  90. child: _buildBuyButtonCard(),
  91. ),
  92. ],
  93. ),
  94. );
  95. }
  96. _buildTitle() {
  97. return SafeArea(
  98. child: Container(
  99. alignment: Alignment.centerLeft,
  100. padding: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w),
  101. child: Row(
  102. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  103. children: [
  104. GestureDetector(
  105. onTap: controller.clickBack,
  106. child: Assets.images.iconStoreBack.image(
  107. width: 32.w,
  108. height: 32.w,
  109. ),
  110. ),
  111. Obx(() {
  112. return SizedBox(
  113. height: 32.h,
  114. child: Row(
  115. mainAxisSize: MainAxisSize.min,
  116. mainAxisAlignment: MainAxisAlignment.center,
  117. crossAxisAlignment: CrossAxisAlignment.center,
  118. children: [
  119. // 会员状态信息
  120. _buildMemberInfo(),
  121. SizedBox(width: 8.w),
  122. controller.isLogin
  123. ? Assets.images.iconMineUserLogged.image(
  124. width: 28.w,
  125. height: 28.w,
  126. )
  127. : Assets.images.iconMineUserNoLogin.image(
  128. width: 28.w,
  129. height: 28.w,
  130. ),
  131. ],
  132. ),
  133. );
  134. }),
  135. ],
  136. ),
  137. ),
  138. );
  139. }
  140. // 会员信息
  141. Widget _buildMemberInfo() {
  142. return Container(
  143. height: 32.h,
  144. alignment: Alignment.center,
  145. padding: EdgeInsets.symmetric(horizontal: 12.w),
  146. decoration: BoxDecoration(
  147. color: Colors.black.withAlpha(77),
  148. borderRadius: BorderRadius.circular(21.r),
  149. ),
  150. child: Text.rich(
  151. TextSpan(children: _getMemberStatusText()),
  152. textAlign: TextAlign.right,
  153. ),
  154. );
  155. }
  156. // 会员状态文字逻辑提取
  157. List<TextSpan> _getMemberStatusText() {
  158. // // 未登录
  159. // if (!controller.isLogin) {
  160. // return [
  161. // TextSpan(
  162. // text: StringName.memberNoLogged,
  163. // style: _vipTextStyle(isHighlight: true),
  164. // ),
  165. // TextSpan(text: StringName.memberCardNoVipDesc, style: _vipTextStyle()),
  166. // ];
  167. // }
  168. final isMember = controller.memberStatusInfo?.isMember ?? false;
  169. final isPermanent = controller.memberStatusInfo?.permanent ?? false;
  170. final username = controller.userInfo?.name ?? '';
  171. if (isMember) {
  172. if (isPermanent) {
  173. return [
  174. TextSpan(
  175. text: StringName.memberCardPermanentVipDesc1,
  176. style: _vipTextStyle(),
  177. ),
  178. TextSpan(
  179. text: StringName.memberCardPermanentVipDesc2,
  180. style: _vipTextStyle(isHighlight: true),
  181. ),
  182. ];
  183. } else {
  184. return [
  185. TextSpan(text: StringName.memberVipDesc, style: _vipTextStyle()),
  186. TextSpan(
  187. text: DateUtil.fromMillisecondsSinceEpoch(
  188. 'yyyy.MM.dd',
  189. controller.memberStatusInfo?.endTimestamp ?? 0,
  190. ),
  191. style: _vipTextStyle(isHighlight: true),
  192. ),
  193. ];
  194. }
  195. }
  196. // 登录但不是会员
  197. return [
  198. TextSpan(
  199. text: controller.userInfo?.name ?? controller.getUserName(),
  200. style: _vipTextStyle(isHighlight: true),
  201. ),
  202. TextSpan(text: StringName.memberCardNoVipDesc, style: _vipTextStyle()),
  203. ];
  204. }
  205. // 统一的会员状态文本样式
  206. TextStyle _vipTextStyle({bool isHighlight = false}) {
  207. return TextStyle(
  208. color: isHighlight ? const Color(0xFFFFD273) : Colors.white,
  209. fontSize: 12.sp,
  210. fontWeight: FontWeight.w400,
  211. );
  212. }
  213. Widget _buildGoodsCard() {
  214. return Container(
  215. margin: EdgeInsets.symmetric(horizontal: 16.w),
  216. padding: EdgeInsets.only(
  217. top: 16.h,
  218. left: 16.w,
  219. right: 16.w,
  220. bottom: 24.h,
  221. ),
  222. decoration: BoxDecoration(
  223. color: Colors.white,
  224. borderRadius: BorderRadius.only(
  225. topLeft: Radius.circular(16.r),
  226. topRight: Radius.circular(16.r),
  227. ),
  228. ),
  229. child: Column(
  230. crossAxisAlignment: CrossAxisAlignment.start,
  231. mainAxisAlignment: MainAxisAlignment.start,
  232. children: [
  233. Assets.images.iconGoodsInfoTitle.image(
  234. width: 115.w,
  235. fit: BoxFit.cover,
  236. ),
  237. SizedBox(height: 16.h),
  238. Obx(() {
  239. return Column(
  240. children:
  241. controller.filteredGoodsList.mapIndexed((index, item) {
  242. return Obx(() {
  243. return GestureDetector(
  244. onTap: () => controller.onGoodsItemClick(item),
  245. child:
  246. PlatformUtil.isIOS
  247. ? _buildGoodsItemIos(
  248. index,
  249. item,
  250. controller.selectedGoodsInfoItem?.id ==
  251. item.id,
  252. )
  253. : _buildGoodsItem(
  254. item,
  255. controller.selectedGoodsInfoItem?.id ==
  256. item.id,
  257. ),
  258. );
  259. });
  260. }).toList(),
  261. );
  262. }),
  263. // iOS平台的产品描述
  264. if (PlatformUtil.isIOS) _buildVipDesc(),
  265. // 非iOS平台,才有支付宝支付和微信支付
  266. if (!PlatformUtil.isIOS) _buildPayWayCard(),
  267. ],
  268. ),
  269. );
  270. }
  271. Widget _buildPayWayCard() {
  272. return GestureDetector(
  273. onTap: () => controller.clickPayWaySwitch(),
  274. child: Container(
  275. height: 36.h,
  276. padding: EdgeInsets.symmetric(horizontal: 10.w),
  277. decoration: ShapeDecoration(
  278. shape: RoundedRectangleBorder(
  279. side: BorderSide(width: 1, color: const Color(0xFFECEBE0)),
  280. borderRadius: BorderRadius.circular(10.r),
  281. ),
  282. ),
  283. child: Row(
  284. children: [
  285. Text(
  286. StringName.storePayWay,
  287. style: Styles.getTextStyleBlack204W400(14.sp),
  288. ),
  289. const Spacer(),
  290. Obx(() {
  291. if (controller.selectedPayWay == null) {
  292. return SizedBox.shrink();
  293. }
  294. return Row(
  295. children: [
  296. Image.asset(
  297. getPaymentIconPath(
  298. payMethod: controller.selectedPayWay!.payMethod,
  299. payPlatform: controller.selectedPayWay!.payPlatform,
  300. ),
  301. width: 20.w,
  302. height: 20.w,
  303. ),
  304. SizedBox(width: 4.w),
  305. Text(
  306. controller.selectedPayWay?.title ?? '',
  307. style: Styles.getTextStyleBlack204W400(14.sp),
  308. ),
  309. SizedBox(width: 6.w),
  310. Assets.images.iconStoreSwitchPay.image(
  311. width: 20.w,
  312. height: 20.w,
  313. fit: BoxFit.fill,
  314. ),
  315. ],
  316. );
  317. }),
  318. ],
  319. ),
  320. ),
  321. );
  322. }
  323. /// 商品-iOS端
  324. Widget _buildGoodsItemIos(int index, GoodsInfo item, bool isSelected) {
  325. // 第一个商品,才有有倒计时
  326. bool hasCountdown = index == 0;
  327. var amountText = item.amountText;
  328. if (index == 0) {
  329. if (controller.isDiscount.value) {
  330. amountText = item.firstAmountText;
  331. }
  332. }
  333. Widget contentWidget = Stack(
  334. children: [
  335. Positioned(
  336. left: 16.w,
  337. top: 0,
  338. right: 0,
  339. bottom: 0,
  340. child: Row(
  341. children: [
  342. // 价格
  343. RichText(
  344. text: TextSpan(
  345. children: [
  346. TextSpan(
  347. text: '¥',
  348. style: Styles.getTextStyleFF663300W700(14.sp),
  349. ),
  350. TextSpan(
  351. text: amountText,
  352. style: Styles.getTextStyleFF663300W700(18.sp),
  353. ),
  354. ],
  355. ),
  356. ),
  357. SizedBox(width: 18.w),
  358. // 名称和描述
  359. Column(
  360. // 垂直居中
  361. mainAxisAlignment: MainAxisAlignment.center,
  362. // 水平左对齐
  363. crossAxisAlignment: CrossAxisAlignment.start,
  364. children: [
  365. // 名称
  366. Text(
  367. item.name,
  368. style: Styles.getTextStyleFF663300W500(15.sp),
  369. ),
  370. // 描述
  371. if (item.mostDesc?.isNotEmpty == true)
  372. AutoSizeText(
  373. item.mostDesc!,
  374. style: TextStyle(
  375. color: Color(0x99673300),
  376. fontSize: 12.sp,
  377. fontWeight: FontWeight.w500,
  378. letterSpacing: -0.60,
  379. ),
  380. maxLines: 1,
  381. overflow: TextOverflow.ellipsis,
  382. // 最小字体
  383. minFontSize: 8,
  384. // 缩小步长,越小越丝滑
  385. stepGranularity: 0.5,
  386. ),
  387. ],
  388. ),
  389. ],
  390. ),
  391. ),
  392. // 勾选状态
  393. Positioned(
  394. top: 0,
  395. right: 22.w,
  396. bottom: 0,
  397. child: Image(
  398. image:
  399. isSelected
  400. ? Assets.images.iconStoreGoodsSelectedSymbolIos.provider()
  401. : Assets.images.iconStoreGoodsNormalSymbolIos.provider(),
  402. width: 20.w,
  403. height: 20.w,
  404. ),
  405. ),
  406. // 倒计时
  407. Positioned(
  408. top: 0,
  409. right: 8,
  410. child: Visibility(
  411. visible: hasCountdown,
  412. child: Row(
  413. crossAxisAlignment: CrossAxisAlignment.center,
  414. mainAxisAlignment: MainAxisAlignment.center,
  415. children: [
  416. Text(
  417. "倒计时",
  418. style: TextStyle(
  419. color: isSelected ? Color(0xFFFFECBB) : Color(0xFFFF9416),
  420. fontSize: 12.sp,
  421. fontWeight: FontWeight.w500,
  422. ),
  423. ),
  424. SizedBox(width: 4.w),
  425. Container(
  426. margin: EdgeInsets.only(top: 2.5.h),
  427. child: Obx(() {
  428. return Text(
  429. CountdownTimer.format(controller.goodsCountdown.value),
  430. style: TextStyle(
  431. color: isSelected ? ColorName.white : Color(0xFFFF9416),
  432. fontSize: 12.sp,
  433. fontWeight: FontWeight.w500,
  434. ),
  435. );
  436. }),
  437. ),
  438. ],
  439. ),
  440. ),
  441. ),
  442. ],
  443. );
  444. // 最终呈现的内容组件
  445. Widget resultWidget;
  446. if (hasCountdown) {
  447. // 有倒计时的商品,不规则,使用图片背景
  448. resultWidget = Container(
  449. decoration: BoxDecoration(
  450. image: DecorationImage(
  451. image:
  452. isSelected
  453. ? Assets.images.bgStoreGoodsItemWithCountdownSelectedIos
  454. .provider()
  455. : Assets.images.bgStoreGoodsItemWithCountdownNormalIos
  456. .provider(),
  457. fit: BoxFit.fill,
  458. ),
  459. ),
  460. child: contentWidget,
  461. );
  462. } else {
  463. // 没有倒计时的商品
  464. resultWidget = Container(
  465. decoration: BoxDecoration(
  466. shape: BoxShape.rectangle,
  467. borderRadius: BorderRadius.circular(8.r),
  468. border: Border.all(
  469. color: isSelected ? Color(0xFFFF9416) : Color(0xFFFEE86B),
  470. width: 2.w,
  471. ),
  472. ),
  473. child: contentWidget,
  474. );
  475. }
  476. // 最后面背景透出来的颜色
  477. Decoration bgDecoration;
  478. if (isSelected) {
  479. // 渐变背景
  480. bgDecoration = ShapeDecoration(
  481. gradient: LinearGradient(
  482. begin: Alignment(-0.06, 0.50),
  483. end: Alignment(1.14, 0.50),
  484. colors: [const Color(0xFFFFF895), const Color(0xFFFFE941)],
  485. ),
  486. shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.r)),
  487. );
  488. } else {
  489. // 纯色背景
  490. bgDecoration = BoxDecoration(
  491. color: Color(0xFFFFFEEE),
  492. borderRadius: BorderRadius.circular(6.r),
  493. );
  494. }
  495. return Container(
  496. margin: EdgeInsets.only(bottom: 8.h),
  497. width: 296.w,
  498. height: 70.h,
  499. decoration: bgDecoration,
  500. child: Stack(
  501. children: [
  502. // 对勾图片
  503. Positioned(
  504. top: 0,
  505. right: 0,
  506. bottom: 0,
  507. child: Assets.images.bgStoreSelectedArrow1Ios.image(
  508. width: 85.w,
  509. height: double.infinity,
  510. ),
  511. ),
  512. resultWidget,
  513. ],
  514. ),
  515. );
  516. }
  517. /// 商品-Android端
  518. Widget _buildGoodsItem(GoodsInfo item, bool isSelected) {
  519. return Container(
  520. margin: EdgeInsets.only(bottom: 8.h),
  521. width: 296.w,
  522. height: 70.h,
  523. decoration: ShapeDecoration(
  524. gradient: LinearGradient(
  525. begin: Alignment(0.77, -0.00),
  526. end: Alignment(0.77, 1.00),
  527. colors:
  528. isSelected
  529. ? [const Color(0xFFFF9416), const Color(0xFFFF7813)]
  530. : [const Color(0xFFFEE057), const Color(0xFFFFC400)],
  531. ),
  532. shape: RoundedRectangleBorder(
  533. borderRadius: BorderRadius.circular(10.r),
  534. ),
  535. ),
  536. child: Row(
  537. children: [
  538. Container(
  539. width: 212.w,
  540. height: 70.h,
  541. decoration: ShapeDecoration(
  542. gradient:
  543. isSelected
  544. ? LinearGradient(
  545. begin: Alignment(-0.06, 0.50),
  546. end: Alignment(1.14, 0.50),
  547. colors: [
  548. const Color(0xFFFFF895),
  549. const Color(0xFFFFE941),
  550. ],
  551. )
  552. : null,
  553. color: isSelected ? null : const Color(0xFFFFFDEE),
  554. shape: RoundedRectangleBorder(
  555. side: BorderSide(width: 1, color: const Color(0xFFFEE86B)),
  556. borderRadius: BorderRadius.circular(isSelected ? 8 : 10.r),
  557. ),
  558. ),
  559. child: Stack(
  560. children: [
  561. if (isSelected)
  562. IgnorePointer(
  563. child: Assets.images.bgStoreSelectedItem.image(
  564. width: 212.w,
  565. height: 70.h,
  566. fit: BoxFit.fill,
  567. ),
  568. ),
  569. Padding(
  570. padding: EdgeInsets.only(left: 16.w),
  571. child: Column(
  572. crossAxisAlignment: CrossAxisAlignment.start,
  573. mainAxisAlignment: MainAxisAlignment.center,
  574. children: [
  575. Row(
  576. children: [
  577. RichText(
  578. text: TextSpan(
  579. children: [
  580. TextSpan(
  581. text: '¥',
  582. style: Styles.getTextStyleFF663300W700(14.sp),
  583. ),
  584. TextSpan(
  585. text: item.priceDescNumber,
  586. style: Styles.getTextStyleFF663300W700(18.sp),
  587. ),
  588. TextSpan(
  589. text: item.priceDescUnit,
  590. style: Styles.getTextStyleFF663300W400(13.sp),
  591. ),
  592. ],
  593. ),
  594. ),
  595. if (item.mostDesc?.isNotEmpty == true)
  596. Container(
  597. constraints: BoxConstraints(
  598. minHeight: 20.w,
  599. maxHeight: 20.w,
  600. minWidth: 40.w,
  601. maxWidth: 120.w,
  602. ),
  603. padding: EdgeInsets.only(
  604. left: 16.w,
  605. top: 2.h,
  606. bottom: 2.h,
  607. right: 4.w,
  608. ),
  609. decoration: BoxDecoration(
  610. image: DecorationImage(
  611. image: Assets.images.iconStoreMost.provider(),
  612. fit: BoxFit.fill,
  613. alignment: Alignment.bottomLeft,
  614. ),
  615. ),
  616. child: AutoSizeText(
  617. item.mostDesc!,
  618. style: TextStyle(
  619. color: Colors.white,
  620. fontSize: 12.sp,
  621. fontWeight: FontWeight.w500,
  622. letterSpacing: -0.60,
  623. ),
  624. maxLines: 1,
  625. overflow: TextOverflow.ellipsis,
  626. minFontSize: 8,
  627. // 最小字体
  628. stepGranularity: 0.5, // 缩小步长,越小越丝滑
  629. ),
  630. ),
  631. ],
  632. ),
  633. Text(
  634. item.description!,
  635. style: Styles.getTextStyle99673300W400(12.sp),
  636. ),
  637. ],
  638. ),
  639. ),
  640. ],
  641. ),
  642. ),
  643. // 右侧
  644. Expanded(
  645. child: Column(
  646. mainAxisAlignment: MainAxisAlignment.center,
  647. crossAxisAlignment: CrossAxisAlignment.center,
  648. children: [
  649. Text(
  650. item.name,
  651. style:
  652. isSelected
  653. ? Styles.getTextStyleFFECBBW500(15.sp)
  654. : Styles.getTextStyleFF663300W500(15.sp),
  655. ),
  656. Container(
  657. padding: EdgeInsets.symmetric(horizontal: 8.w),
  658. decoration: ShapeDecoration(
  659. color: isSelected ? const Color(0xFFFFECBB) : null,
  660. gradient:
  661. isSelected
  662. ? null
  663. : LinearGradient(
  664. begin: Alignment(0.77, -0.00),
  665. end: Alignment(0.77, 1.00),
  666. colors: [
  667. const Color(0xFFFF9416),
  668. const Color(0xFFFF7813),
  669. ],
  670. ),
  671. shape: RoundedRectangleBorder(
  672. borderRadius: BorderRadius.circular(
  673. isSelected ? 17.r : 10.r,
  674. ),
  675. ),
  676. ),
  677. child: Text(
  678. '¥${item.amountText}',
  679. textAlign: TextAlign.center,
  680. style:
  681. isSelected
  682. ? Styles.getTextStyleFF7F14W500(12.sp)
  683. : Styles.getTextStyleWhiteW500(12.sp),
  684. ),
  685. ),
  686. ],
  687. ),
  688. ),
  689. ],
  690. ),
  691. );
  692. }
  693. /// 最后的底部圆角
  694. Widget _buildLastBottomCorner({required Widget child}) {
  695. return Container(
  696. alignment: Alignment.centerLeft,
  697. margin: EdgeInsets.symmetric(horizontal: 16.w),
  698. padding: EdgeInsets.symmetric(horizontal: PlatformUtil.isIOS ? 4.w : 16.w),
  699. width: double.infinity,
  700. decoration: ShapeDecoration(
  701. gradient: LinearGradient(
  702. begin: Alignment(0.00, 0.50),
  703. end: Alignment(1.00, 0.50),
  704. colors: [const Color(0x7FFFF3A3), const Color(0x21FFF3A3)],
  705. ),
  706. shape: RoundedRectangleBorder(
  707. borderRadius: BorderRadius.only(
  708. bottomLeft: Radius.circular(20.r),
  709. bottomRight: Radius.circular(20.r),
  710. ),
  711. ),
  712. shadows: [
  713. BoxShadow(
  714. color: Colors.black.withAlpha(10),
  715. blurRadius: 10.r,
  716. spreadRadius: 0.r,
  717. offset: Offset(0, 8.r),
  718. ),
  719. ],
  720. ),
  721. child: Column(
  722. child: child,
  723. );
  724. }
  725. /// 产品描述
  726. Widget _buildVipDesc() {
  727. return Obx(() {
  728. return Text(
  729. controller.selectedGoodsInfoItem?.selectDesc ?? "",
  730. style: Styles.getTextStyle99673300W400(12.sp),
  731. );
  732. });
  733. }
  734. // 轮播图
  735. Widget _buildBanner(BuildContext context) {
  736. return SizedBox(
  737. width: double.infinity,
  738. child: Stack(
  739. children: [
  740. CarouselSlider(
  741. carouselController: controller.carouselSliderController,
  742. options: CarouselOptions(
  743. height: 280.h,
  744. viewportFraction: 1,
  745. initialPage: 0,
  746. enableInfiniteScroll: true,
  747. reverse: false,
  748. autoPlay: true,
  749. autoPlayInterval: const Duration(seconds: 3),
  750. autoPlayAnimationDuration: const Duration(milliseconds: 800),
  751. autoPlayCurve: Curves.fastOutSlowIn,
  752. scrollDirection: Axis.horizontal,
  753. onPageChanged: (index, reason) {
  754. controller.onBannerChanged(index, reason);
  755. },
  756. ),
  757. items:
  758. controller.bannerList.map((item) {
  759. return item.banner.image(
  760. width: double.infinity,
  761. fit: BoxFit.cover,
  762. );
  763. }).toList(),
  764. ),
  765. Positioned(bottom: 0, left: 0, right: 0, child: _buildIndicator()),
  766. ],
  767. ),
  768. );
  769. }
  770. // 指示器
  771. _buildIndicator() {
  772. return Container(
  773. height: 36.h,
  774. margin: EdgeInsets.symmetric(horizontal: 16.w),
  775. decoration: ShapeDecoration(
  776. color: const Color(0xE5121212),
  777. shape: RoundedRectangleBorder(
  778. borderRadius: BorderRadius.circular(21.r),
  779. ),
  780. ),
  781. child: Row(
  782. mainAxisAlignment: MainAxisAlignment.spaceAround,
  783. children:
  784. controller.bannerList
  785. .asMap()
  786. .entries
  787. .map((entry) {
  788. return Obx(() {
  789. final isSelectedBanner =
  790. controller.currentBannerIndex == entry.key;
  791. return Row(
  792. mainAxisAlignment: MainAxisAlignment.spaceAround,
  793. children: [
  794. GestureDetector(
  795. onTap:
  796. () =>
  797. controller.carouselSliderController
  798. .animateToPage(entry.key),
  799. child: SizedBox(
  800. width: 100.w,
  801. child: Stack(
  802. alignment: Alignment.center,
  803. clipBehavior: Clip.none,
  804. children: [
  805. if (isSelectedBanner)
  806. Positioned(
  807. top: -8.h,
  808. child: controller
  809. .bannerList[entry.key]
  810. .indicatorImg
  811. .image(
  812. width: 100.w,
  813. height: 40.h,
  814. fit: BoxFit.fill,
  815. ),
  816. )
  817. else
  818. Text(
  819. controller.bannerList[entry.key].unSelectedDesc,
  820. style: Styles.getTextStyleWhiteW400(14.sp),
  821. ),
  822. ],
  823. ),
  824. ),
  825. ),
  826. if (entry.key != controller.bannerList.length - 1)
  827. Padding(
  828. padding: EdgeInsets.only(left: 4.w),
  829. child: Assets.images.iconStoreDivider.image(
  830. width: 2.w,
  831. height: 17.h,
  832. fit: BoxFit.fill,
  833. ),
  834. ),
  835. ],
  836. );
  837. });
  838. }).toList(),
  839. ),
  840. );
  841. }
  842. Widget _buildUserReviews() {
  843. return Container(
  844. width: double.infinity,
  845. child: Column(
  846. crossAxisAlignment: CrossAxisAlignment.center,
  847. children: [
  848. Assets.images.iconStoreUserReviewsTitle.image(
  849. width: 240.w,
  850. fit: BoxFit.cover,
  851. ),
  852. SizedBox(height: 16.h),
  853. Container(
  854. width: double.infinity,
  855. decoration: BoxDecoration(
  856. borderRadius: BorderRadius.circular(19.r),
  857. gradient: LinearGradient(
  858. begin: Alignment.topCenter,
  859. end: Alignment.bottomCenter,
  860. colors: [Colors.white, Color(0xfffff8d4)],
  861. ),
  862. ),
  863. child: Column(
  864. children: [
  865. SizedBox(height: 20.h),
  866. Container(
  867. width: 326.w,
  868. decoration: BoxDecoration(
  869. borderRadius: BorderRadius.circular(19.r),
  870. image: DecorationImage(
  871. alignment: Alignment.topCenter,
  872. image: Assets.images.bgStoreUserReviews.provider(),
  873. fit: BoxFit.contain,
  874. ),
  875. ),
  876. child: Column(
  877. children: [
  878. Container(
  879. padding: EdgeInsets.only(left: 16.w),
  880. alignment: Alignment.centerLeft,
  881. height: 39.h,
  882. child: Assets.images.iconStoreUserReviewsLogo.image(
  883. width: 92.w,
  884. height: 24.h,
  885. ),
  886. ),
  887. Container(
  888. width: 326.w,
  889. decoration: ShapeDecoration(
  890. color: Colors.white,
  891. shape: RoundedRectangleBorder(
  892. borderRadius: BorderRadius.circular(16.r),
  893. ),
  894. shadows: [
  895. BoxShadow(
  896. color: Colors.black.withAlpha(10),
  897. blurRadius: 10.r,
  898. spreadRadius: 0.r,
  899. offset: Offset(0, 5.r),
  900. ),
  901. ],
  902. ),
  903. child: Column(
  904. children:
  905. controller.userReviewsList.map((item) {
  906. return _buildReviewsItem(item);
  907. }).toList(),
  908. ),
  909. ),
  910. ],
  911. ),
  912. ),
  913. ],
  914. ),
  915. ),
  916. ],
  917. ),
  918. );
  919. }
  920. Widget _buildReviewsItem(StoreUserReviewsBean item) {
  921. return Container(
  922. padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 12.h),
  923. child: Column(
  924. crossAxisAlignment: CrossAxisAlignment.start,
  925. children: [
  926. Row(
  927. children: [
  928. item.avatar.image(width: 28.w, height: 28.h, fit: BoxFit.cover),
  929. SizedBox(width: 10.w),
  930. Text(
  931. item.userName,
  932. style: Styles.getTextStyleBlack204W500(14.sp),
  933. ),
  934. SizedBox(width: 6.w),
  935. Assets.images.iconStorePermanentMember.image(
  936. width: 70.w,
  937. height: 20.h,
  938. fit: BoxFit.cover,
  939. ),
  940. ],
  941. ),
  942. SizedBox(height: 4.h),
  943. Padding(
  944. padding: EdgeInsets.only(left: 38.w),
  945. child: Text(
  946. item.userReviews,
  947. style: TextStyle(
  948. color: Colors.black.withAlpha(153),
  949. fontSize: 12.sp,
  950. fontWeight: FontWeight.w400,
  951. ),
  952. ),
  953. ),
  954. SizedBox(height: 12.h),
  955. if (controller.userReviewsList.indexOf(item) !=
  956. controller.userReviewsList.length - 1)
  957. HorizontalDashedLine(
  958. width: 304.w,
  959. color: const Color(0XFFEDEBE1),
  960. strokeWidth: 2.h,
  961. dashLength: 4.w,
  962. dashSpace: 4.w,
  963. ),
  964. ],
  965. ),
  966. );
  967. }
  968. // 用户须知
  969. Widget _buildUserNotice() {
  970. return Container(
  971. margin: EdgeInsets.symmetric(horizontal: 16.w),
  972. decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.r)),
  973. child: Column(
  974. crossAxisAlignment: CrossAxisAlignment.start,
  975. children: [
  976. Text('购买须知', style: Styles.getTextStyleFF663300W400(12.sp)),
  977. SizedBox(height: 8.h),
  978. Obx(() {
  979. return Text(
  980. controller.configRepository.memberTips.value,
  981. style: Styles.getTextStyle99673300W400(10.sp),
  982. );
  983. }),
  984. SizedBox(height: 150.h),
  985. ],
  986. ),
  987. );
  988. }
  989. /// 恢复订阅
  990. Widget _buildRecoverSubscribe() {
  991. return Container(
  992. margin: EdgeInsets.only(left: 16.w, top: 8.h, right: 16.w),
  993. child: Row(
  994. children: [
  995. Text(
  996. "⚠️ 订阅未生效?点此试试",
  997. style: TextStyle(
  998. color: Color(0xFF666355),
  999. fontSize: 13.sp,
  1000. fontWeight: FontWeight.w400,
  1001. ),
  1002. ),
  1003. GestureDetector(
  1004. onTap: () {
  1005. // 恢复订阅
  1006. controller.clickRecoverSubscribe();
  1007. },
  1008. child: Text(
  1009. " 恢复订阅>",
  1010. style: TextStyle(
  1011. color: Color(0xFF479DF7),
  1012. fontSize: 13.sp,
  1013. fontWeight: FontWeight.w400,
  1014. ),
  1015. ),
  1016. ),
  1017. ],
  1018. ),
  1019. );
  1020. }
  1021. /// 恢复订阅
  1022. Widget _buildRecoverSubscribe() {
  1023. return Container(
  1024. margin: EdgeInsets.only(left: 16.w, top: 8.h, right: 16.w),
  1025. child: Row(
  1026. children: [
  1027. Text(
  1028. "⚠️ 订阅未生效?点此试试",
  1029. style: TextStyle(
  1030. color: Color(0xFF666355),
  1031. fontSize: 13.sp,
  1032. fontWeight: FontWeight.w400,
  1033. ),
  1034. ),
  1035. GestureDetector(
  1036. onTap: () {
  1037. // 恢复订阅
  1038. controller.clickRecoverSubscribe();
  1039. },
  1040. child: Text(
  1041. " 恢复订阅>",
  1042. style: TextStyle(
  1043. color: Color(0xFF479DF7),
  1044. fontSize: 13.sp,
  1045. fontWeight: FontWeight.w400,
  1046. ),
  1047. ),
  1048. ),
  1049. ],
  1050. ),
  1051. );
  1052. }
  1053. /// 恢复订阅
  1054. Widget _buildRecoverSubscribe() {
  1055. return Container(
  1056. margin: EdgeInsets.only(left: 16.w, top: 8.h, right: 16.w),
  1057. child: Row(
  1058. children: [
  1059. Text(
  1060. "⚠️ 订阅未生效?点此试试",
  1061. style: TextStyle(
  1062. color: Color(0xFF666355),
  1063. fontSize: 13.sp,
  1064. fontWeight: FontWeight.w400,
  1065. ),
  1066. ),
  1067. GestureDetector(
  1068. onTap: () {
  1069. // 恢复订阅
  1070. controller.clickRecoverSubscribe();
  1071. },
  1072. child: Text(
  1073. " 恢复订阅>",
  1074. style: TextStyle(
  1075. color: Color(0xFF479DF7),
  1076. fontSize: 13.sp,
  1077. fontWeight: FontWeight.w400,
  1078. ),
  1079. ),
  1080. ),
  1081. ],
  1082. ),
  1083. );
  1084. }
  1085. /// 恢复订阅
  1086. Widget _buildRecoverSubscribe() {
  1087. return Container(
  1088. margin: EdgeInsets.only(left: 16.w, top: 8.h, right: 16.w),
  1089. child: Row(
  1090. children: [
  1091. Text(
  1092. "⚠️ 订阅未生效?点此试试",
  1093. style: TextStyle(
  1094. color: Color(0xFF666355),
  1095. fontSize: 13.sp,
  1096. fontWeight: FontWeight.w400,
  1097. ),
  1098. ),
  1099. GestureDetector(
  1100. onTap: () {
  1101. // 恢复订阅
  1102. controller.clickRecoverSubscribe();
  1103. },
  1104. child: Text(
  1105. " 恢复订阅>",
  1106. style: TextStyle(
  1107. color: Color(0xFF479DF7),
  1108. fontSize: 13.sp,
  1109. fontWeight: FontWeight.w400,
  1110. ),
  1111. ),
  1112. ),
  1113. SizedBox(height: 150.h),
  1114. ],
  1115. ),
  1116. );
  1117. }
  1118. /// 恢复订阅
  1119. Widget _buildRecoverSubscribe() {
  1120. return Container(
  1121. margin: EdgeInsets.only(left: 16.w, top: 8.h, right: 16.w),
  1122. child: Row(
  1123. children: [
  1124. Text(
  1125. "⚠️ 订阅未生效?点此试试",
  1126. style: TextStyle(
  1127. color: Color(0xFF666355),
  1128. fontSize: 13.sp,
  1129. fontWeight: FontWeight.w400,
  1130. ),
  1131. ),
  1132. GestureDetector(
  1133. onTap: () {
  1134. // 恢复订阅
  1135. controller.clickRecoverSubscribe();
  1136. },
  1137. child: Text(
  1138. " 恢复订阅>",
  1139. style: TextStyle(
  1140. color: Color(0xFF479DF7),
  1141. fontSize: 13.sp,
  1142. fontWeight: FontWeight.w400,
  1143. ),
  1144. ),
  1145. ),
  1146. ],
  1147. ),
  1148. );
  1149. }
  1150. Widget _buildBuyButtonCard() {
  1151. return Container(
  1152. width: 360.w,
  1153. padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 11.h),
  1154. decoration: ShapeDecoration(
  1155. color: Colors.white,
  1156. shape: RoundedRectangleBorder(
  1157. borderRadius: BorderRadius.only(
  1158. topLeft: Radius.circular(24.r),
  1159. topRight: Radius.circular(24.r),
  1160. ),
  1161. ),
  1162. shadows: [
  1163. BoxShadow(
  1164. color: Color(0x99FFE498),
  1165. blurRadius: 20,
  1166. offset: Offset(0, 0),
  1167. spreadRadius: 0,
  1168. ),
  1169. ],
  1170. ),
  1171. child: Column(
  1172. children: [
  1173. GestureDetector(
  1174. onTap: controller.clickPayNow,
  1175. child: Container(
  1176. alignment: Alignment.topCenter,
  1177. width: 328.w,
  1178. height: 56.w,
  1179. decoration: ShapeDecoration(
  1180. color: const Color(0xFFFFF587),
  1181. shape: RoundedRectangleBorder(
  1182. borderRadius: BorderRadius.circular(30.55.r),
  1183. ),
  1184. ),
  1185. child: Container(
  1186. width: 328.w,
  1187. height: 54.w,
  1188. decoration: ShapeDecoration(
  1189. gradient: LinearGradient(
  1190. begin: Alignment(0.60, -0.39),
  1191. end: Alignment(0.60, 0.95),
  1192. colors: [
  1193. const Color(0xFFF95FAC),
  1194. const Color(0xFFFD5E4D),
  1195. const Color(0xFFFD5E4D),
  1196. const Color(0xFFFB8A3C),
  1197. ],
  1198. ),
  1199. shape: RoundedRectangleBorder(
  1200. borderRadius: BorderRadius.circular(30.55.r),
  1201. ),
  1202. ),
  1203. child: Center(
  1204. child: Text(
  1205. StringName.storePayNow,
  1206. style: Styles.getTextStyleWhiteW500(17.sp),
  1207. ),
  1208. ),
  1209. ),
  1210. ),
  1211. ),
  1212. // 安卓平台的隐私协议和服务条款
  1213. if (!PlatformUtil.isIOS) _buildPrivacy(),
  1214. ],
  1215. ),
  1216. );
  1217. }
  1218. /// 隐私协议和服务条款
  1219. Widget _buildPrivacy({
  1220. Color privacyColor = const Color(0xFF459FFF),
  1221. MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
  1222. }) {
  1223. return Row(
  1224. mainAxisAlignment: mainAxisAlignment,
  1225. children: [
  1226. Obx(() {
  1227. return GestureDetector(
  1228. behavior: HitTestBehavior.opaque,
  1229. onTap: () {
  1230. controller.isAgree.value = !controller.isAgree.value;
  1231. },
  1232. child: Padding(
  1233. margin: EdgeInsets.only(top: PlatformUtil.isIOS ? 0.h : 2.h),
  1234. padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 5.w),
  1235. child:
  1236. controller.isAgree.value
  1237. ? Assets.images.iconStoreAgreePrivacy.image(
  1238. width: 16.w,
  1239. height: 16.w,
  1240. )
  1241. : SizedBox(
  1242. child: Container(
  1243. padding: EdgeInsets.all(1.w),
  1244. width: 16.w,
  1245. height: 16.w,
  1246. child: Container(
  1247. decoration: BoxDecoration(
  1248. shape: BoxShape.circle,
  1249. border: Border.all(
  1250. color: Colors.black.withAlpha(153),
  1251. width: 1.w,
  1252. ),
  1253. ),
  1254. ),
  1255. ),
  1256. ),
  1257. ),
  1258. );
  1259. }),
  1260. Transform.translate(
  1261. offset: Offset(-2.w, 0),
  1262. child: Text.rich(
  1263. PlatformUtil.isIOS
  1264. ? TextSpan(
  1265. children: [
  1266. TextSpan(
  1267. text: StringName.textSpanIHaveReadAndAgree,
  1268. style: TextStyle(
  1269. color: Colors.black.withAlpha(153),
  1270. fontSize: 10.sp,
  1271. fontWeight: FontWeight.w400,
  1272. ),
  1273. ),
  1274. ClickTextSpan(
  1275. text: StringName.textSpanPrivacyPolicy,
  1276. url: WebUrl.privacyPolicy,
  1277. color: privacyColor,
  1278. ),
  1279. ClickTextSpan(
  1280. text: StringName.textSpanServiceTerms,
  1281. url: WebUrl.serviceAgreement,
  1282. color: privacyColor,
  1283. ),
  1284. TextSpan(
  1285. text: StringName.textSpanAnd,
  1286. style: TextStyle(
  1287. color: Colors.black.withAlpha(153),
  1288. fontSize: 10.sp,
  1289. fontWeight: FontWeight.w400,
  1290. ),
  1291. ),
  1292. ClickTextSpan(
  1293. text: StringName.textSpanMembershipAgreement,
  1294. url: WebUrl.subscribeAgreement,
  1295. color: privacyColor,
  1296. ),
  1297. ],
  1298. )
  1299. : TextSpan(
  1300. children: [
  1301. TextSpan(
  1302. text: StringName.textSpanIHaveReadAndAgree,
  1303. style: TextStyle(
  1304. color: Colors.black.withAlpha(153),
  1305. fontSize: 10.sp,
  1306. fontWeight: FontWeight.w400,
  1307. ),
  1308. ),
  1309. ClickTextSpan(
  1310. text: StringName.textSpanPrivacyPolicy,
  1311. url: WebUrl.privacyPolicy,
  1312. color: privacyColor,
  1313. ),
  1314. TextSpan(
  1315. text: StringName.textSpanAnd,
  1316. style: TextStyle(
  1317. color: Colors.black.withAlpha(153),
  1318. fontSize: 10.sp,
  1319. fontWeight: FontWeight.w400,
  1320. ),
  1321. ),
  1322. ClickTextSpan(
  1323. text: StringName.textSpanServiceTerms,
  1324. url: WebUrl.serviceAgreement,
  1325. color: privacyColor,
  1326. ),
  1327. ],
  1328. ),
  1329. ),
  1330. ),
  1331. ],
  1332. );
  1333. }
  1334. }