member_page.dart 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. import 'dart:io';
  2. import 'package:cached_network_image/cached_network_image.dart';
  3. import 'package:flutter/cupertino.dart';
  4. import 'package:flutter/gestures.dart';
  5. import 'package:flutter/material.dart';
  6. import 'package:flutter/src/widgets/framework.dart';
  7. import 'package:flutter_screenutil/flutter_screenutil.dart';
  8. import 'package:get/get.dart';
  9. import 'package:get/get_core/src/get_main.dart';
  10. import 'package:location/base/base_page.dart';
  11. import 'package:location/module/member/activity/member_activity_page.dart';
  12. import 'package:location/module/member/member_controller.dart';
  13. import 'package:location/resource/assets.gen.dart';
  14. import 'package:location/resource/colors.gen.dart';
  15. import 'package:location/utils/common_expand.dart';
  16. import 'package:location/utils/project_expand.dart';
  17. import 'package:location/widget/auto_scroll_list_view.dart';
  18. import '../../data/bean/goods_bean.dart';
  19. import '../../data/bean/goods_evaluate_info.dart';
  20. import '../../data/bean/member_status_info.dart';
  21. import '../../data/bean/pay_item_bean.dart';
  22. import '../../data/consts/payment_type.dart';
  23. import '../../resource/string.gen.dart';
  24. import '../../router/app_pages.dart';
  25. import '../../utils/date_util.dart';
  26. import '../../widget/activity_countdown_txt_view.dart';
  27. import '../../widget/animated_switcher_widget.dart';
  28. import '../../widget/shimmer_effect.dart';
  29. import 'member_discount_countdown_widget.dart';
  30. import 'member_header_cycle_widget.dart';
  31. ///进入会员类型
  32. enum MemberPageType {
  33. ///通用进入
  34. universalAccessEnter,
  35. ///倒计时试用完会员进入
  36. afeterTrialMemberEnter,
  37. ///加好友进入
  38. addFriendToEnter,
  39. //活动页
  40. activity,
  41. }
  42. class MemberPage extends BasePage<MemberController> {
  43. MemberPage({super.key, this.pageType});
  44. late MemberPageType? pageType = MemberPageType.universalAccessEnter;
  45. static void start(
  46. {MemberPageType? enterTyp = MemberPageType.universalAccessEnter}) {
  47. if (enterTyp == MemberPageType.activity) {
  48. MemberActivityPage.start();
  49. } else {
  50. Get.toNamed(RoutePath.member, arguments: enterTyp);
  51. }
  52. }
  53. @override
  54. bool immersive() {
  55. return true;
  56. }
  57. @override
  58. bool statusBarDarkFont() {
  59. return true;
  60. }
  61. @override
  62. Widget buildBody(BuildContext context) {
  63. return PopScope(
  64. canPop: false,
  65. onPopInvokedWithResult: (bool didPop, dynamic result) async {
  66. if (didPop) {
  67. return;
  68. }
  69. controller.onPopBack();
  70. },
  71. child: Stack(
  72. children: [buildScrollView(), buildHeadBar(), buildMemberBottomView()],
  73. ),
  74. );
  75. }
  76. Widget buildScrollView() {
  77. return SingleChildScrollView(
  78. physics: const ClampingScrollPhysics(),
  79. controller: controller.scrollController,
  80. child: Stack(
  81. children: [
  82. MemberHeaderCycleWidget(),
  83. Column(
  84. children: [
  85. SizedBox(
  86. height:
  87. 249.w + MediaQuery.of(Get.context!).padding.top - 24.w),
  88. Container(
  89. decoration: BoxDecoration(
  90. color: ColorName.white,
  91. borderRadius: BorderRadius.only(
  92. topLeft: Radius.circular(20.w),
  93. topRight: Radius.circular(20.w)),
  94. boxShadow: [
  95. BoxShadow(
  96. color: Color.fromRGBO(0, 63, 127, 0.10),
  97. blurRadius: 28.6,
  98. offset: Offset(0, -20),
  99. ),
  100. ],
  101. ),
  102. child: Stack(
  103. children: [
  104. Container(
  105. margin:
  106. EdgeInsets.only(left: 2.w, right: 2.w, top: 2.w),
  107. decoration: BoxDecoration(
  108. borderRadius: BorderRadius.only(
  109. topLeft: Radius.circular(20.w),
  110. topRight: Radius.circular(20.w)),
  111. image: DecorationImage(
  112. image: Assets.images.iconMemberVipMiddleBg
  113. .provider(),
  114. )),
  115. width: double.infinity,
  116. height: 174.w,
  117. ),
  118. Container(
  119. //width: double.infinity,
  120. decoration: BoxDecoration(
  121. borderRadius: BorderRadius.only(
  122. topLeft: Radius.circular(20.w),
  123. topRight: Radius.circular(20.w)),
  124. ),
  125. child: Column(
  126. crossAxisAlignment: CrossAxisAlignment.start,
  127. children: [
  128. SizedBox(height: 15.w),
  129. buildUserInfoView(),
  130. SizedBox(height: 12.w),
  131. buildGoodsList(),
  132. SizedBox(height: 12.w),
  133. buildPayWayView(),
  134. SizedBox(height: 12.w),
  135. Padding(
  136. padding: EdgeInsets.only(left: 16.w),
  137. child: Text(StringName.memberUserEvaluate,
  138. style: TextStyle(
  139. fontSize: 16.sp,
  140. color: ColorName.black,
  141. fontWeight: FontWeight.bold)),
  142. ),
  143. //SizedBox(height: 8.w),
  144. buildUserEvaluateList(),
  145. Visibility(
  146. visible: Platform.isIOS,
  147. child: Padding(
  148. padding: EdgeInsets.only(
  149. left: 16.w, right: 16.w, top: 16.w),
  150. child: Text(
  151. StringName.memberIosPayDesc,
  152. style: TextStyle(
  153. fontSize: 10.sp,
  154. color: ColorName.black60),
  155. ),
  156. )),
  157. SizedBox(
  158. height: 190.w +
  159. MediaQuery.of(Get.context!).padding.bottom)
  160. ],
  161. ),
  162. ),
  163. ],
  164. ),
  165. )
  166. ],
  167. ),
  168. ],
  169. ));
  170. }
  171. Widget buildGoodsList() {
  172. return Obx(() {
  173. final goods = controller.goodsList;
  174. final itemCount = goods.length;
  175. if (itemCount == 0) {
  176. return Container();
  177. }
  178. final widgets = <Widget>[];
  179. // 添加第一个商品(特殊样式)
  180. if (itemCount >= 1) {
  181. widgets.add(_createSpecialProduct(goods[0]));
  182. }
  183. // 如果有多个商品,添加普通样式商品
  184. if (itemCount >= 2) {
  185. widgets.add(SizedBox(height: 7.w));
  186. final rowItems = <Widget>[];
  187. // 计算可显示的普通商品数量(最多2个)
  188. final ordinaryCount = itemCount >= 3 ? 2 : 1;
  189. for (int i = 1; i <= ordinaryCount + 1 && i < itemCount; i++) {
  190. rowItems.add(Expanded(child: _ordinaryProductWidget(goods[i])));
  191. // 为除最后一个商品外的每个商品添加间距
  192. if (i < ordinaryCount + 1 && i < itemCount - 1) {
  193. rowItems.add(SizedBox(width: 8));
  194. }
  195. }
  196. widgets.add(Container(
  197. margin: EdgeInsets.only(left: 16.w, right: 16.w),
  198. child: Row(
  199. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  200. children: rowItems,
  201. ),
  202. ));
  203. }
  204. return Column(
  205. children: widgets,
  206. );
  207. });
  208. }
  209. //特惠产品
  210. Widget _createSpecialProduct(GoodsBean goodsInfo) {
  211. bool isSelected = controller.selectedGoods?.id == goodsInfo.id;
  212. return GestureDetector(
  213. onTap: () {
  214. controller.onGoodsItemClick(goodsInfo);
  215. },
  216. child: Container(
  217. height: 96.w,
  218. margin: EdgeInsets.only(left: 12.w, right: 16.w),
  219. padding: EdgeInsets.only(left: 17.w),
  220. decoration: BoxDecoration(
  221. image: DecorationImage(
  222. image: isSelected
  223. ? Assets.images.iconMemberSpecialProductsSelect.provider()
  224. : Assets.images.iconMemberSpecialProductsNormal.provider(),
  225. fit: BoxFit.fill,
  226. ),
  227. ),
  228. child: Column(
  229. children: [
  230. SizedBox(
  231. height: 29.w,
  232. ),
  233. Row(
  234. children: [
  235. Column(
  236. children: [
  237. RichText(
  238. text: TextSpan(
  239. style: TextStyle(
  240. color: isSelected
  241. ? '#FF5656'.color
  242. : "#323133".color,
  243. fontWeight: FontWeight.bold),
  244. children: [
  245. TextSpan(
  246. text: '¥',
  247. style: TextStyle(fontSize: 16.sp, height: 1)),
  248. TextSpan(
  249. text: goodsInfo.amount.divideBy100(),
  250. style: TextStyle(
  251. fontSize: 28.sp,
  252. height: 1,
  253. //fontFamily: FontFamily.oppoSans
  254. ))
  255. ])),
  256. Text('¥${goodsInfo.originalAmount.divideBy100()}',
  257. style: TextStyle(
  258. decoration: TextDecoration.lineThrough,
  259. decorationColor: ColorName.black40,
  260. decorationThickness: 1.0,
  261. fontSize: 12.sp,
  262. color: ColorName.black40))
  263. ],
  264. ),
  265. SizedBox(
  266. width: 22.24.w,
  267. ),
  268. Column(
  269. crossAxisAlignment: CrossAxisAlignment.start,
  270. children: [
  271. Text(
  272. goodsInfo.name,
  273. style: TextStyle(
  274. fontSize: 17.sp,
  275. color: "#333333".color,
  276. fontWeight: FontWeight.bold),
  277. ),
  278. SizedBox(
  279. height: 3.w,
  280. ),
  281. Text(
  282. goodsInfo.description ?? "",
  283. style: TextStyle(
  284. fontSize: 11.sp,
  285. color: "#9191BA".color,
  286. fontWeight: FontWeight.bold),
  287. ),
  288. ],
  289. ),
  290. ],
  291. ),
  292. ],
  293. ),
  294. ),
  295. );
  296. }
  297. ///普通产品
  298. Widget _ordinaryProductWidget(GoodsBean goodsInfo) {
  299. bool isSelected = controller.selectedGoods?.id == goodsInfo.id;
  300. return GestureDetector(
  301. onTap: () {
  302. controller.onGoodsItemClick(goodsInfo);
  303. },
  304. child: SizedBox(
  305. width: double.infinity,
  306. height: 62.w,
  307. child: Stack(
  308. children: [
  309. Container(
  310. width: double.infinity,
  311. height: double.infinity,
  312. decoration: BoxDecoration(
  313. gradient: LinearGradient(
  314. colors: ['#FFFFFF'.color, '#F3EAFF'.color],
  315. begin: Alignment.topLeft,
  316. end: Alignment.bottomRight,
  317. stops: const [0.4, 1.0]),
  318. borderRadius: BorderRadius.circular(12.w),
  319. border: Border.all(
  320. color: isSelected ? '#7A13C6'.color : '#F1E6FF'.color,
  321. width: isSelected ? 2.5.w : 1.w,
  322. ))),
  323. Container(
  324. padding: EdgeInsets.only(left: 16.w, right: 12.w),
  325. child: Column(
  326. children: [
  327. SizedBox(
  328. height: 15.w,
  329. ),
  330. Row(
  331. mainAxisAlignment: MainAxisAlignment.spaceBetween,
  332. children: [
  333. Column(
  334. crossAxisAlignment: CrossAxisAlignment.start,
  335. children: [
  336. Text(
  337. goodsInfo.name,
  338. style: TextStyle(
  339. fontSize: 12.sp,
  340. color: "#333333".color,
  341. fontWeight: FontWeight.bold),
  342. ),
  343. //SizedBox(height: 6.w,),
  344. Text(
  345. goodsInfo.description ?? "",
  346. style: TextStyle(
  347. fontSize: 10.sp,
  348. color: ColorName.black40,
  349. fontWeight: FontWeight.bold),
  350. ),
  351. ],
  352. ),
  353. //SizedBox(width: 22.24.w,),
  354. Column(
  355. crossAxisAlignment: CrossAxisAlignment.end,
  356. children: [
  357. RichText(
  358. text: TextSpan(
  359. style: TextStyle(
  360. color: isSelected
  361. ? '#FF5656'.color
  362. : "#323133".color,
  363. fontWeight: FontWeight.bold),
  364. children: [
  365. TextSpan(
  366. text: '¥',
  367. style: TextStyle(
  368. color: isSelected
  369. ? "#FF5656".color
  370. : ColorName.black80,
  371. fontSize: 11.sp,
  372. height: 1)),
  373. TextSpan(
  374. text: goodsInfo.amount.divideBy100(),
  375. style: TextStyle(
  376. fontSize: 20.sp,
  377. height: 1,
  378. ))
  379. ])),
  380. Text('¥${goodsInfo.originalAmount.divideBy100()}',
  381. style: TextStyle(
  382. decoration: TextDecoration.lineThrough,
  383. decorationColor: ColorName.black30,
  384. decorationThickness: 1.0,
  385. fontSize: 10.sp,
  386. color: ColorName.black30))
  387. ],
  388. ),
  389. ],
  390. ),
  391. ],
  392. ),
  393. )
  394. ],
  395. ),
  396. ),
  397. );
  398. }
  399. Widget buildMemberBottomView() {
  400. return Obx(() {
  401. if (controller.memberStatusInfo != null &&
  402. controller.memberStatusInfo?.permanent == true) {
  403. return SizedBox(); // 不显示
  404. }
  405. return Align(
  406. alignment: Alignment.bottomCenter,
  407. child: Stack(
  408. children: [
  409. IgnorePointer(
  410. ignoring: true, // 不处理事件
  411. child: Container(
  412. height: 190.w + MediaQuery.of(Get.context!).padding.bottom,
  413. decoration: BoxDecoration(
  414. gradient: LinearGradient(
  415. begin: Alignment.bottomCenter,
  416. end: Alignment.topCenter,
  417. colors: [
  418. Colors.white,
  419. "#00FFFFFF".color,
  420. ],
  421. stops: [0.4368, 1.0],
  422. ),
  423. ),
  424. ),
  425. ),
  426. Positioned(
  427. left: 0,
  428. right: 0,
  429. bottom: MediaQuery.of(Get.context!).padding.bottom,
  430. child: IntrinsicHeight(
  431. child: Column(
  432. children: [
  433. Stack(
  434. children: [
  435. Container(
  436. width: 336.w,
  437. height: 47.w,
  438. decoration: BoxDecoration(
  439. borderRadius: BorderRadius.only(
  440. topLeft: Radius.circular(30.w),
  441. topRight: Radius.circular(30.w),
  442. ),
  443. color: '#FFFED8'.color),
  444. child: Align(
  445. alignment: Alignment(0.0, -0.75),
  446. child: Row(
  447. mainAxisAlignment: MainAxisAlignment.center,
  448. children: [
  449. Text(
  450. StringName.memberActivityCountdown,
  451. style: TextStyle(
  452. fontSize: 11.sp,
  453. color: '#FF5656'.color),
  454. ),
  455. SizedBox(width: 4.w),
  456. Obx(() {
  457. return ActivityCountdownTextView(
  458. timeItemHeight: 15.w,
  459. contentPadding: EdgeInsets.zero,
  460. timeItemWidth: 16.w,
  461. textStyle: TextStyle(
  462. fontSize: 10.sp,
  463. color: Colors.white),
  464. duration: controller.activityDuration ??
  465. Duration(seconds: 0),
  466. separator: buildCountdownSeparator(),
  467. timeBgBoxDecoration: BoxDecoration(
  468. color: '#FF5656'.color,
  469. borderRadius:
  470. BorderRadius.circular(3.w),
  471. ));
  472. }),
  473. SizedBox(width: 4.w),
  474. Text(
  475. StringName
  476. .memberActivitySpeciallyPreferential,
  477. style: TextStyle(
  478. fontSize: 10.sp,
  479. color: '#FF5656'.color),
  480. )
  481. ],
  482. ),
  483. ),
  484. ),
  485. GestureDetector(
  486. onTap: controller.onBuyClick,
  487. child: Container(
  488. margin: EdgeInsets.only(top: 24.w),
  489. height: 50.w,
  490. width: 336.w,
  491. child: ShimmerEffect(
  492. image:
  493. Assets.images.imgMemberBtnShadow.provider(),
  494. shimmerWidthFactor: 0.244047619047619,
  495. duration: Duration(milliseconds: 3000),
  496. delay: Duration(milliseconds: 800),
  497. child: Container(
  498. height: 50.w,
  499. width: 336.w,
  500. alignment: Alignment.center,
  501. decoration: BoxDecoration(
  502. image: DecorationImage(
  503. image: Assets
  504. .images.iconMemberSettlementBg
  505. .provider(),
  506. fit: BoxFit.fill)),
  507. child: Text(
  508. StringName.memberVipUnlock,
  509. style: TextStyle(
  510. fontSize: 18.sp,
  511. color: '#FFF8EF'.color,
  512. fontWeight: FontWeight.bold),
  513. ),
  514. ),
  515. ),
  516. ),
  517. )
  518. ],
  519. ),
  520. SizedBox(height: 8.w),
  521. buildPrivacyPolicyView(),
  522. SizedBox(height: 12.w),
  523. ],
  524. ),
  525. ),
  526. )
  527. ],
  528. ));
  529. });
  530. }
  531. Widget buildCountdownSeparator() {
  532. return Container(
  533. margin: EdgeInsets.symmetric(horizontal: 2.w),
  534. child: IntrinsicHeight(
  535. child: Column(
  536. children: [
  537. Container(
  538. width: 2.w,
  539. height: 2.w,
  540. decoration: BoxDecoration(
  541. color: '#FF5656'.color,
  542. shape: BoxShape.circle,
  543. ),
  544. ),
  545. SizedBox(height: 3.w),
  546. Container(
  547. width: 2.w,
  548. height: 2.w,
  549. decoration: BoxDecoration(
  550. color: '#FF5656'.color,
  551. shape: BoxShape.circle,
  552. ),
  553. )
  554. ],
  555. ),
  556. ),
  557. );
  558. }
  559. Widget buildUserInfoView() {
  560. return Row(
  561. children: [
  562. SizedBox(width: 18.w),
  563. controller.isLogin
  564. ? ClipOval(
  565. child: Container(
  566. width: 32.w,
  567. height: 32.w,
  568. child: CachedNetworkImage(
  569. imageUrl: controller.memberStatusInfo?.avatar ?? "",
  570. fit: BoxFit.cover,
  571. ),
  572. ),
  573. )
  574. : Assets.images.iconMemberAvatar.image(width: 32.w, height: 32.w),
  575. SizedBox(width: 7.w),
  576. Column(
  577. crossAxisAlignment: CrossAxisAlignment.start,
  578. children: [
  579. Obx(() {
  580. return GestureDetector(
  581. onTap: controller.onLoginClick,
  582. child: Text(
  583. controller.phone?.isNotEmpty == true
  584. ? controller.getUserName(controller.phone!)
  585. : StringName.mineAccountGoLogin,
  586. style: TextStyle(
  587. fontSize: 13.sp,
  588. color: "#333333".color,
  589. fontWeight: FontWeight.bold)),
  590. );
  591. }),
  592. Container(
  593. height: 16.w,
  594. width: MediaQuery.of(Get.context!).size.width - 77.w,
  595. child: Row(
  596. // 主轴默认左对齐,通过Spacer推挤右侧内容
  597. children: [
  598. // 左侧内容:会员等级描述 + VIP卡片描述
  599. Visibility(
  600. visible: MemberStatusInfo.getLevelDesc(
  601. controller.memberStatusInfo)
  602. .isNotEmpty,
  603. child: Text(
  604. MemberStatusInfo.getLevelDesc(
  605. controller.memberStatusInfo),
  606. style: TextStyle(
  607. fontSize: 11.sp,
  608. fontWeight: FontWeight.w700,
  609. color: '#9144F8'.color)),
  610. ),
  611. buildMemberCardVipDesc(),
  612. Spacer(),
  613. ],
  614. ),
  615. )
  616. ],
  617. ),
  618. SizedBox(width: 20.w)
  619. ],
  620. );
  621. }
  622. Widget buildMemberCardVipDesc() {
  623. return Obx(() {
  624. String desc = '';
  625. if (!controller.isLogin) {
  626. if ((controller.memberStatusInfo?.endTimestamp ?? 0) > 0) {
  627. desc =
  628. '${DateUtil.fromMillisecondsSinceEpoch('yyyy-MM-dd', controller.memberStatusInfo?.endTimestamp ?? 0)} ${StringName.memberCardExpirationDesc}';
  629. } else {
  630. desc = StringName.memberCardNoLoginDesc;
  631. }
  632. } else if (controller.memberStatusInfo == null ||
  633. controller.memberStatusInfo?.expired == true) {
  634. desc = StringName.memberCardNoVipDesc;
  635. } else if (controller.memberStatusInfo?.expired == false &&
  636. controller.memberStatusInfo?.permanent == true) {
  637. desc = StringName.memberCardPermanentVipDesc;
  638. } else {
  639. desc =
  640. '${DateUtil.fromMillisecondsSinceEpoch('yyyy-MM-dd', controller.memberStatusInfo?.endTimestamp ?? 0)} ${StringName.memberCardExpirationDesc}';
  641. }
  642. return Text(desc,
  643. style: TextStyle(
  644. fontSize: 11.sp,
  645. color: ColorName.black50,
  646. fontWeight: FontWeight.w400));
  647. });
  648. }
  649. Widget buildHeadBar() {
  650. return Column(
  651. children: [
  652. SizedBox(
  653. height: MediaQuery.of(Get.context!).padding.top,
  654. ),
  655. SizedBox(
  656. width: double.infinity,
  657. height: 56.w,
  658. child: Row(
  659. crossAxisAlignment: CrossAxisAlignment.center,
  660. children: [
  661. SizedBox(
  662. width: 15.w,
  663. ),
  664. GestureDetector(
  665. onTap: () => controller.onPopBack(),
  666. child: Assets.images.iconMemberVipBack
  667. .image(width: 26.w, height: 26..w),
  668. ),
  669. SizedBox(
  670. width: 10.w,
  671. ),
  672. Container(
  673. width: MediaQuery.of(Get.context!).size.width - 51.w,
  674. padding: EdgeInsets.only(right: 12.w),
  675. child: buildVerticalSlideshowWidget()),
  676. ],
  677. ),
  678. )
  679. ],
  680. );
  681. }
  682. Widget buildVerticalSlideshowWidget() {
  683. return Row(
  684. children: [
  685. Expanded(
  686. child: Center(
  687. child: Container(
  688. width: 192.w,
  689. height: 26.w,
  690. decoration: BoxDecoration(
  691. color: ColorName.black40,
  692. borderRadius: BorderRadius.circular(87.w),
  693. ),
  694. child: Center(
  695. child: AnimatedSwitcherWidget(
  696. controller: controller.switcherController)),
  697. ),
  698. ),
  699. ),
  700. if (Platform.isAndroid)
  701. SizedBox(
  702. width: 40.w,
  703. ),
  704. if (Platform.isIOS)
  705. Obx(() {
  706. return Visibility(
  707. visible: Platform.isIOS &&
  708. controller.accountRepository.isLogin.value,
  709. child: Row(
  710. children: [
  711. SizedBox(
  712. width: 26.w,
  713. ),
  714. GestureDetector(
  715. onTap: controller.clickRecoverSubscribe,
  716. child: Container(
  717. height: 26.w,
  718. decoration: BoxDecoration(
  719. color: ColorName.black40,
  720. borderRadius: BorderRadius.circular(26.w / 2.0),
  721. ),
  722. padding: EdgeInsets.symmetric(horizontal: 10.w),
  723. child: Row(
  724. children: [
  725. Assets.images.iconAppleRecoverSubscribe
  726. .image(width: 14.w, height: 14.w),
  727. Text(StringName.appleRecoverSubscribeTxt,
  728. style: TextStyle(
  729. fontSize: 11.sp,
  730. color: ColorName.white,
  731. fontWeight: FontWeight.w500)),
  732. ],
  733. ),
  734. ),
  735. )
  736. ],
  737. ));
  738. })
  739. ],
  740. );
  741. }
  742. Widget buildPrivacyPolicyView() {
  743. return Padding(
  744. padding: EdgeInsets.only(left: 12.w),
  745. child: RichText(
  746. text: TextSpan(
  747. style: TextStyle(fontSize: 12.sp, color: ColorName.black40),
  748. children: [
  749. TextSpan(text: '购买前请先阅读'),
  750. TextSpan(
  751. recognizer: TapGestureRecognizer()
  752. ..onTap = () {
  753. controller.onPrivacyPolicyClick();
  754. },
  755. text: '隐私政策',
  756. style: TextStyle(
  757. color: ColorName.black60,
  758. decoration: TextDecoration.underline)),
  759. TextSpan(text: '&'),
  760. TextSpan(
  761. recognizer: TapGestureRecognizer()
  762. ..onTap = () {
  763. controller.onTermOfServiceClick();
  764. },
  765. text: '服务条款',
  766. style: TextStyle(
  767. color: ColorName.black60,
  768. decoration: TextDecoration.underline)),
  769. if (Platform.isIOS) TextSpan(text: '&'),
  770. if (Platform.isIOS)
  771. TextSpan(
  772. recognizer: TapGestureRecognizer()
  773. ..onTap = () {
  774. controller.onRenewalAgreementClick();
  775. },
  776. text: '会员协议',
  777. style: TextStyle(
  778. color: ColorName.black60,
  779. decoration: TextDecoration.underline)),
  780. ])),
  781. );
  782. }
  783. Widget buildFunctionList() {
  784. return SizedBox(
  785. height: 80.w,
  786. child: AutoScrollListView(
  787. padding: EdgeInsets.only(left: 12.w),
  788. itemBuilder: (ctx, index) {
  789. final item = controller.funList[index];
  790. return Padding(
  791. padding: EdgeInsets.only(right: 20.w),
  792. child: Column(
  793. children: [
  794. Image.asset(item.iconPath, width: 36.w, height: 36.w),
  795. Spacer(flex: 3),
  796. Text(item.funName,
  797. style: TextStyle(
  798. fontSize: 12.8.sp,
  799. color: ColorName.black90,
  800. fontWeight: FontWeight.bold)),
  801. Spacer(flex: 2),
  802. Text(item.funDesc,
  803. style: TextStyle(
  804. fontSize: 10.6.sp,
  805. color: ColorName.black50,
  806. )),
  807. ],
  808. ),
  809. );
  810. },
  811. itemCount: controller.funList.length));
  812. }
  813. Widget buildUserEvaluateList() {
  814. return Obx(() {
  815. return Column(
  816. children: [
  817. for (int index = 0; index < controller.evaluateList.length; index++)
  818. buildUserEvaluateItem(controller.evaluateList.value[index],
  819. index == controller.evaluateList.value.length - 1, index == 0)
  820. ],
  821. );
  822. });
  823. }
  824. Widget buildUserEvaluateItem(
  825. GoodsEvaluateInfo item, bool isLast, bool isFirst) {
  826. return Container(
  827. padding: EdgeInsets.symmetric(horizontal: 16.w),
  828. child: Column(
  829. crossAxisAlignment: CrossAxisAlignment.start,
  830. children: [
  831. SizedBox(height: isFirst ? 16.w : 20.w),
  832. Row(
  833. children: [
  834. CachedNetworkImage(
  835. imageUrl: item.avatar,
  836. width: 34.w,
  837. height: 34.w,
  838. ),
  839. SizedBox(width: 10.w),
  840. // 使用 Expanded 确保 Column 占据剩余宽度
  841. Expanded(
  842. child: Column(
  843. crossAxisAlignment: CrossAxisAlignment.start,
  844. children: [
  845. Row(
  846. children: [
  847. Text(
  848. item.name,
  849. style: TextStyle(
  850. fontSize: 14.sp,
  851. color: "#333333".color,
  852. fontWeight: FontWeight.w400),
  853. ),
  854. Spacer(),
  855. Assets.images.iconMemberCommentVerySatisfied
  856. .image(width: 16.w, height: 16.w),
  857. SizedBox(width: 5.w),
  858. Text(
  859. item.description,
  860. style: TextStyle(
  861. fontSize: 11.sp,
  862. color: "#DC8514".color,
  863. fontWeight: FontWeight.w500),
  864. )
  865. ],
  866. ),
  867. SizedBox(height: 5.w),
  868. Text(
  869. item.content,
  870. style: TextStyle(
  871. fontSize: 11.sp,
  872. color: '#333333'.color,
  873. fontWeight: FontWeight.w400),
  874. maxLines: null, // 允许无限行数
  875. softWrap: true, // 允许文本换行
  876. )
  877. ],
  878. ),
  879. )
  880. ],
  881. ),
  882. SizedBox(height: 20.w),
  883. Visibility(
  884. visible: !isLast,
  885. child: Container(
  886. color: '#EEEEEE'.color,
  887. height: 1.w,
  888. ),
  889. )
  890. ],
  891. ),
  892. );
  893. }
  894. Widget buildPayWayView() {
  895. return Obx(() {
  896. return Visibility(
  897. visible: Platform.isIOS ? false : controller.payItemList.isNotEmpty,
  898. child: Container(
  899. margin: EdgeInsets.symmetric(horizontal: 16.w),
  900. child: Column(
  901. crossAxisAlignment: CrossAxisAlignment.start,
  902. children: [
  903. SizedBox(height: 12.w),
  904. Text("支付方式",
  905. style: TextStyle(
  906. fontSize: 16.sp,
  907. color: ColorName.black,
  908. fontWeight: FontWeight.bold)),
  909. SizedBox(
  910. height: 5.w,
  911. ),
  912. for (PayItemBean item in controller.payItemList)
  913. buildPayWayItem(item)
  914. ],
  915. ),
  916. ),
  917. );
  918. });
  919. }
  920. Widget buildPayWayItem(PayItemBean item) {
  921. return GestureDetector(
  922. behavior: HitTestBehavior.translucent,
  923. onTap: () => controller.onPayWayItemClick(item),
  924. child: Obx(() {
  925. bool isSelected = controller.selectedPayWay?.id == item.id;
  926. return Container(
  927. padding: EdgeInsets.symmetric(vertical: 12.w),
  928. child: Row(
  929. children: [
  930. Image.asset(
  931. getPaymentIconPath(
  932. payMethod: item.payMethod, payPlatform: item.payPlatform),
  933. width: 20.w,
  934. height: 20.w),
  935. SizedBox(width: 8.w),
  936. Text(item.title,
  937. style: TextStyle(
  938. fontSize: 12.sp,
  939. color: ColorName.black,
  940. fontWeight: FontWeight.w400)),
  941. Spacer(),
  942. Image.asset(
  943. isSelected
  944. ? Assets.images.iconCbSelected.path
  945. : Assets.images.iconCbUnSelect.path,
  946. width: 16.w,
  947. height: 16.w),
  948. ],
  949. ),
  950. );
  951. }),
  952. );
  953. }
  954. }