member_page.dart 31 KB

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