member_page.dart 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827
  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: Obx(() {
  365. return Column(
  366. mainAxisAlignment: MainAxisAlignment.end,
  367. children: [
  368. Container(
  369. width: double.infinity, // 设置容器宽度
  370. height: 50.w, // 设置容器高度
  371. padding: EdgeInsets.only(left: 20.w),
  372. decoration: BoxDecoration(
  373. image: DecorationImage(
  374. image: Assets.images.iconMemberSettlementBg.provider(),
  375. fit: BoxFit.fill,
  376. ),
  377. ),
  378. // 实现内阴影效果
  379. child: Row(
  380. children: [
  381. Transform.translate(
  382. offset: Offset(0, 3), // 向下偏移4像素
  383. child: Text('¥',
  384. style: TextStyle(
  385. fontSize: 14.sp,
  386. color: '#FFF8EF'.color,
  387. fontWeight: FontWeight.bold)),
  388. ),
  389. SizedBox(width: 3.w,),
  390. Text(
  391. controller.selectedGoods?.amount.divideBy100() ?? '--',
  392. style: TextStyle(
  393. fontSize: 24.sp,
  394. color: '#FFF8EF'.color,
  395. fontWeight: FontWeight.bold),
  396. ),
  397. SizedBox(width: 3.w,),
  398. Text("/",
  399. style: TextStyle(
  400. fontSize: 12.sp,
  401. fontWeight: FontWeight.w400,
  402. color: "#FFF8EF".color),),
  403. Text('原价${controller.selectedGoods?.originalAmount.divideBy100()}',
  404. style: TextStyle(
  405. decoration: TextDecoration.lineThrough,
  406. decorationColor: Colors.white,
  407. decorationThickness: 1.0,
  408. fontSize: 12.sp,
  409. fontWeight: FontWeight.w400,
  410. color: "#FFF8EF".color)),
  411. Spacer(),
  412. GestureDetector(
  413. onTap: controller.onBuyClick,
  414. child: Container(
  415. decoration: BoxDecoration(
  416. image: DecorationImage(
  417. image: Assets.images.iconMemberSettlementConfirm.provider(),
  418. fit: BoxFit.fill,
  419. )
  420. ),
  421. // width: 164.w,
  422. // height: 44.w,
  423. padding: EdgeInsets.only(left: 64.w,right: 29.w),
  424. child: Center(
  425. child: Text(
  426. controller.memberStatusInfo?.expired == false
  427. ? StringName.memberVipRenew
  428. : StringName.memberVipUnlock,
  429. style: TextStyle(
  430. fontSize: 18.sp,
  431. color: "#9B3800".color,
  432. fontWeight: FontWeight.bold),
  433. ),
  434. ),
  435. ),
  436. )
  437. ],
  438. ),
  439. ),
  440. SizedBox(height: 8.w,),
  441. buildPrivacyPolicyView(),
  442. ],
  443. );
  444. }),
  445. ),
  446. ),
  447. );
  448. });
  449. }
  450. Widget buildUserInfoView() {
  451. return Row(
  452. children: [
  453. SizedBox(width: 18.w),
  454. controller.isLogin ? ClipOval(
  455. child: Container(
  456. width: 32.w,
  457. height: 32.w,
  458. child: CachedNetworkImage(
  459. imageUrl: controller.memberStatusInfo?.avatar ?? "",
  460. fit: BoxFit.cover,
  461. ),
  462. ),
  463. ) : Assets.images.iconMemberAvatar.image(width: 32.w, height: 32.w),
  464. SizedBox(width: 7.w),
  465. Column(
  466. crossAxisAlignment: CrossAxisAlignment.start,
  467. children: [
  468. Obx(() {
  469. return GestureDetector(
  470. onTap: controller.onLoginClick,
  471. child: Text(
  472. controller.phone?.isNotEmpty == true
  473. ? controller.getUserName(controller.phone!)
  474. : StringName.mineAccountGoLogin,
  475. style: TextStyle(
  476. fontSize: 13.sp,
  477. color: "#333333".color,
  478. fontWeight: FontWeight.bold)),
  479. );
  480. }),
  481. Container(
  482. height: 16.w,
  483. width: MediaQuery.of(Get.context!).size.width - 77.w,
  484. child: Row(
  485. // 主轴默认左对齐,通过Spacer推挤右侧内容
  486. children: [
  487. // 左侧内容:会员等级描述 + VIP卡片描述
  488. Visibility(
  489. visible: MemberStatusInfo.getLevelDesc(controller.memberStatusInfo).isNotEmpty,
  490. child: Text(
  491. MemberStatusInfo.getLevelDesc(controller.memberStatusInfo),
  492. style: TextStyle(
  493. fontSize: 11.sp,
  494. fontWeight: FontWeight.w700,
  495. color: '#9144F8'.color
  496. )
  497. ),
  498. ),
  499. buildMemberCardVipDesc(),
  500. Spacer(),
  501. Container(
  502. child: MemberDiscountCountdownWidget(
  503. onExpired: () {
  504. print("sssfsdfs");
  505. controller.isShowCount.value = false;
  506. },
  507. ),
  508. )
  509. ],
  510. ),
  511. )
  512. ],
  513. ),
  514. SizedBox(width: 20.w)
  515. ],
  516. );
  517. }
  518. Widget buildMemberCardVipDesc() {
  519. return Obx(() {
  520. String desc = '';
  521. if (!controller.isLogin) {
  522. //desc = StringName.memberCardNoLoginDesc;
  523. desc =
  524. '${DateUtil.fromMillisecondsSinceEpoch('yyyy-MM-dd', controller.memberStatusInfo?.endTimestamp ?? 0)} ${StringName.memberCardExpirationDesc}';
  525. } else if (controller.memberStatusInfo == null ||
  526. controller.memberStatusInfo?.expired == true) {
  527. desc = StringName.memberCardNoVipDesc;
  528. } else if (controller.memberStatusInfo?.expired == false &&
  529. controller.memberStatusInfo?.permanent == true) {
  530. desc = StringName.memberCardPermanentVipDesc;
  531. } else {
  532. desc =
  533. '${DateUtil.fromMillisecondsSinceEpoch('yyyy-MM-dd', controller.memberStatusInfo?.endTimestamp ?? 0)} ${StringName.memberCardExpirationDesc}';
  534. }
  535. return Text(desc,
  536. style: TextStyle(fontSize: 11.sp, color: ColorName.black50,fontWeight: FontWeight.w400));
  537. });
  538. }
  539. Widget buildHeadBar() {
  540. return Obx(() {
  541. return Stack(
  542. children: [
  543. /*IgnorePointer(
  544. child: Container(
  545. color: ColorName.colorPrimary.withOpacity(controller.toolBarOpacity),
  546. child: SafeArea(
  547. child: SizedBox(
  548. width: double.infinity,
  549. height: 56.w,
  550. ),
  551. ),
  552. ),
  553. ),*/
  554. SafeArea(
  555. child: SizedBox(
  556. width: double.infinity,
  557. height: 56.w,
  558. child: Stack(alignment: Alignment.center, children: [
  559. Positioned(
  560. left: 15.w,
  561. child: GestureDetector(
  562. onTap: () => controller.onPopBack(),
  563. child: Assets.images.iconMemberVipBack
  564. .image(width: 26.w, height: 26..w),
  565. )),
  566. Container(
  567. padding: EdgeInsets.only(left: 51.w,right: 12.w),
  568. child: buildVerticalSlideshowWidget())
  569. ]),
  570. ),
  571. ),
  572. ],
  573. );
  574. });
  575. }
  576. Widget buildVerticalSlideshowWidget() {
  577. return Row(
  578. children: [
  579. Visibility(visible: !Platform.isIOS, child: Spacer()),
  580. Container(
  581. width: 192.w,
  582. height: 26.w,
  583. decoration: BoxDecoration(
  584. color: ColorName.black40,
  585. borderRadius: BorderRadius.circular(87.w),
  586. ),
  587. child: Center(
  588. child: AnimatedSwitcherWidget(
  589. controller: controller.switcherController)),
  590. ),
  591. Spacer(),
  592. Visibility(
  593. visible: Platform.isIOS && controller.accountRepository.isLogin.value,
  594. child: GestureDetector(
  595. onTap: controller.clickRecoverSubscribe,
  596. child: Container(
  597. height: 26.w,
  598. decoration: BoxDecoration(
  599. color: ColorName.black40,
  600. borderRadius: BorderRadius.circular(26.w / 2.0),
  601. ),
  602. padding: EdgeInsets.symmetric(horizontal: 10.w),
  603. child: Row(
  604. children: [
  605. Assets.images.iconAppleRecoverSubscribe.image(width: 14.w,height: 14.w),
  606. Text(StringName.appleRecoverSubscribeTxt,
  607. style: TextStyle(
  608. fontSize: 11.sp,
  609. color: ColorName.white,
  610. fontWeight: FontWeight.w500)),
  611. ],
  612. ),
  613. ),
  614. )
  615. )
  616. ],
  617. );
  618. }
  619. Widget buildPrivacyPolicyView() {
  620. return Padding(
  621. padding: EdgeInsets.only(left: 12.w),
  622. child: RichText(
  623. text: TextSpan(
  624. style: TextStyle(fontSize: 12.sp, color: ColorName.black40),
  625. children: [
  626. TextSpan(text: '购买前请先阅读'),
  627. TextSpan(
  628. recognizer: TapGestureRecognizer()
  629. ..onTap = () {
  630. controller.onPrivacyPolicyClick();
  631. },
  632. text: '隐私政策',
  633. style: TextStyle(
  634. color: ColorName.black60,
  635. decoration: TextDecoration.underline)),
  636. TextSpan(text: '&'),
  637. TextSpan(
  638. recognizer: TapGestureRecognizer()
  639. ..onTap = () {
  640. controller.onTermOfServiceClick();
  641. },
  642. text: '服务条款',
  643. style: TextStyle(
  644. color: ColorName.black60,
  645. decoration: TextDecoration.underline)),
  646. ])),
  647. );
  648. }
  649. Widget buildFunctionList() {
  650. return SizedBox(
  651. height: 80.w,
  652. child: AutoScrollListView(
  653. padding: EdgeInsets.only(left: 12.w),
  654. itemBuilder: (ctx, index) {
  655. final item = controller.funList[index];
  656. return Padding(
  657. padding: EdgeInsets.only(right: 20.w),
  658. child: Column(
  659. children: [
  660. Image.asset(item.iconPath, width: 36.w, height: 36.w),
  661. Spacer(flex: 3),
  662. Text(item.funName,
  663. style: TextStyle(
  664. fontSize: 12.8.sp,
  665. color: ColorName.black90,
  666. fontWeight: FontWeight.bold)),
  667. Spacer(flex: 2),
  668. Text(item.funDesc,
  669. style: TextStyle(
  670. fontSize: 10.6.sp,
  671. color: ColorName.black50,
  672. )),
  673. ],
  674. ),
  675. );
  676. },
  677. itemCount: controller.funList.length));
  678. }
  679. Widget buildUserEvaluateList() {
  680. return Obx(() {
  681. return Column(
  682. children: [
  683. for (int index = 0; index < controller.evaluateList.length; index++)
  684. buildUserEvaluateItem(controller.evaluateList.value[index],
  685. index == controller.evaluateList.value.length - 1,index == 0)
  686. ],
  687. );
  688. });
  689. }
  690. Widget buildUserEvaluateItem(GoodsEvaluateInfo item, bool isLast,bool isFirst) {
  691. return Container(
  692. padding: EdgeInsets.symmetric(horizontal: 16.w),
  693. child: Column(
  694. crossAxisAlignment: CrossAxisAlignment.start,
  695. children: [
  696. SizedBox(height: isFirst? 16.w : 20.w),
  697. Row(
  698. children: [
  699. CachedNetworkImage(imageUrl: item.avatar,width: 34.w, height: 34.w,),
  700. SizedBox(width: 10.w),
  701. // 使用 Expanded 确保 Column 占据剩余宽度
  702. Expanded(
  703. child: Column(
  704. crossAxisAlignment: CrossAxisAlignment.start,
  705. children: [
  706. Row(
  707. children: [
  708. Text(
  709. item.name,
  710. style: TextStyle(fontSize: 14.sp, color: "#333333".color, fontWeight: FontWeight.w400),
  711. ),
  712. Spacer(),
  713. Assets.images.iconMemberCommentVerySatisfied.image(width: 16.w,height: 16.w),
  714. SizedBox(width: 5.w),
  715. Text(
  716. item.description,
  717. style: TextStyle(fontSize: 11.sp, color: "#DC8514".color, fontWeight: FontWeight.w500),
  718. )
  719. ],
  720. ),
  721. SizedBox(height: 5.w),
  722. Text(
  723. item.content,
  724. style: TextStyle(fontSize: 11.sp, color: '#333333'.color, fontWeight: FontWeight.w400),
  725. maxLines: null, // 允许无限行数
  726. softWrap: true, // 允许文本换行
  727. )
  728. ],
  729. ),
  730. )
  731. ],
  732. ),
  733. SizedBox(height: 20.w),
  734. Visibility(
  735. child: Container(
  736. color: '#EEEEEE'.color,
  737. height: 1.w,
  738. ),
  739. )
  740. ],
  741. ),
  742. );
  743. }
  744. Widget buildPayWayView() {
  745. return Obx(() {
  746. return Visibility(
  747. visible: Platform.isIOS ? false : controller.payItemList.isNotEmpty,
  748. child: Container(
  749. margin: EdgeInsets.symmetric(horizontal: 16.w),
  750. child: Column(
  751. crossAxisAlignment: CrossAxisAlignment.start,
  752. children: [
  753. SizedBox(height: 12.w),
  754. Text("支付方式",
  755. style: TextStyle(fontSize: 16.sp, color: ColorName.black,fontWeight: FontWeight.bold)),
  756. SizedBox(height: 5.w,),
  757. for (PayItemBean item in controller.payItemList)
  758. buildPayWayItem(item)
  759. ],
  760. ),
  761. ),
  762. );
  763. });
  764. }
  765. Widget buildPayWayItem(PayItemBean item) {
  766. return GestureDetector(
  767. behavior: HitTestBehavior.translucent,
  768. onTap: () => controller.onPayWayItemClick(item),
  769. child: Obx(() {
  770. bool isSelected = controller.selectedPayWay?.id == item.id;
  771. return Container(
  772. padding: EdgeInsets.symmetric(vertical: 12.w),
  773. child: Row(
  774. children: [
  775. Image.asset(
  776. getPaymentIconPath(
  777. payMethod:item.payMethod, payPlatform: item.payPlatform),
  778. width: 20.w,
  779. height: 20.w),
  780. SizedBox(width: 8.w),
  781. Text(item.title,
  782. style: TextStyle(fontSize: 12.sp, color: ColorName.black,fontWeight: FontWeight.w400)),
  783. Spacer(),
  784. Image.asset(
  785. isSelected
  786. ? Assets.images.iconCbSelected.path
  787. : Assets.images.iconCbUnSelect.path,
  788. width: 16.w,
  789. height: 16.w),],
  790. ),
  791. );
  792. }),
  793. );
  794. }
  795. }