member_page.dart 30 KB

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