member_page.dart 30 KB

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