member_page.dart 30 KB

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