member_page.dart 31 KB

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