| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234 |
- import 'package:auto_size_text/auto_size_text.dart';
- import 'package:carousel_slider/carousel_slider.dart';
- import 'package:collection/collection.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_screenutil/flutter_screenutil.dart';
- import 'package:get/get.dart';
- import 'package:keyboard/base/base_page.dart';
- import 'package:keyboard/data/consts/payment_type.dart';
- import 'package:keyboard/data/consts/web_url.dart';
- import 'package:keyboard/module/store/store_controller.dart';
- import 'package:keyboard/module/store/store_user_reviews_bean.dart';
- import 'package:keyboard/resource/string.gen.dart';
- import 'package:keyboard/widget/platform_util.dart';
- import '../../data/bean/goods_info.dart';
- import '../../data/consts/constants.dart';
- import '../../resource/assets.gen.dart';
- import '../../resource/colors.gen.dart';
- import '../../router/app_pages.dart';
- import '../../utils/count_down_timer.dart';
- import '../../utils/date_util.dart';
- import '../../widget/horizontal_dashed_line.dart';
- import '../../utils/styles.dart';
- import '../../widget/click_text_span.dart';
- import '../browser/browser_page.dart';
- class StorePage extends BasePage<StoreController> {
- const StorePage({super.key});
- static start() {
- Get.toNamed(RoutePath.store);
- }
- @override
- backgroundColor() => const Color(0xFFFFF8D4);
- @override
- bool immersive() {
- return true;
- }
- @override
- Widget buildBody(BuildContext context) {
- Widget bottomArea;
- if (PlatformUtil.isIOS) {
- bottomArea = Column(
- children: [
- // iOS平台的隐私协议和服务条款
- _buildLastBottomCorner(
- child: Container(
- // margin: EdgeInsets.only(left: 16.w),
- child: _buildPrivacy(
- privacyColor: Color(0x99673300),
- mainAxisAlignment: MainAxisAlignment.start,
- ),
- ),
- ),
- // 恢复订阅入口
- _buildRecoverSubscribe(),
- SizedBox(height: 50.h),
- ],
- );
- } else {
- // 安卓端,可以有会员心声和购买须知
- bottomArea = Column(
- children: [
- // 产品描述
- _buildLastBottomCorner(child: _buildVipDesc()),
- SizedBox(height: 32.h),
- _buildUserReviews(),
- SizedBox(height: 20.h),
- _buildUserNotice(),
- ],
- );
- }
- return Stack(
- children: [
- SingleChildScrollView(
- child: Column(
- children: [
- _buildBanner(context),
- SizedBox(height: 12.h),
- _buildGoodsCard(),
- bottomArea,
- ],
- ),
- Positioned(top: 0, left: 0, right: 0, child: _buildTitle()),
- Positioned(
- bottom: 0,
- left: 0,
- right: 0,
- child: _buildBuyButtonCard(),
- ),
- ],
- ),
- );
- }
- _buildTitle() {
- return SafeArea(
- child: Container(
- alignment: Alignment.centerLeft,
- padding: EdgeInsets.only(top: 16.h, left: 16.w, right: 16.w),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: [
- GestureDetector(
- onTap: controller.clickBack,
- child: Assets.images.iconStoreBack.image(
- width: 32.w,
- height: 32.w,
- ),
- ),
- Obx(() {
- return SizedBox(
- height: 32.h,
- child: Row(
- mainAxisSize: MainAxisSize.min,
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- // 会员状态信息
- _buildMemberInfo(),
- SizedBox(width: 8.w),
- controller.isLogin
- ? Assets.images.iconMineUserLogged.image(
- width: 28.w,
- height: 28.w,
- )
- : Assets.images.iconMineUserNoLogin.image(
- width: 28.w,
- height: 28.w,
- ),
- ],
- ),
- );
- }),
- ],
- ),
- ),
- );
- }
- // 会员信息
- Widget _buildMemberInfo() {
- return Container(
- height: 32.h,
- alignment: Alignment.center,
- padding: EdgeInsets.symmetric(horizontal: 12.w),
- decoration: BoxDecoration(
- color: Colors.black.withAlpha(77),
- borderRadius: BorderRadius.circular(21.r),
- ),
- child: Text.rich(
- TextSpan(children: _getMemberStatusText()),
- textAlign: TextAlign.right,
- ),
- );
- }
- // 会员状态文字逻辑提取
- List<TextSpan> _getMemberStatusText() {
- // 未登录
- if (!controller.isLogin) {
- return [
- TextSpan(
- text: StringName.memberNoLogged,
- style: _vipTextStyle(isHighlight: true),
- ),
- TextSpan(text: StringName.memberCardNoVipDesc, style: _vipTextStyle()),
- ];
- }
- final isMember = controller.memberStatusInfo?.isMember ?? false;
- final isPermanent = controller.memberStatusInfo?.permanent ?? false;
- final username = controller.userInfo?.name ?? '';
- if (isMember) {
- if (isPermanent) {
- return [
- TextSpan(
- text: StringName.memberCardPermanentVipDesc1,
- style: _vipTextStyle(),
- ),
- TextSpan(
- text: StringName.memberCardPermanentVipDesc2,
- style: _vipTextStyle(isHighlight: true),
- ),
- ];
- } else {
- return [
- TextSpan(text: StringName.memberVipDesc, style: _vipTextStyle()),
- TextSpan(
- text: DateUtil.fromMillisecondsSinceEpoch(
- 'yyyy.MM.dd',
- controller.memberStatusInfo?.endTimestamp ?? 0,
- ),
- style: _vipTextStyle(isHighlight: true),
- ),
- ];
- }
- }
- // 登录但不是会员
- return [
- TextSpan(
- text: controller.userInfo?.name ?? controller.getUserName(),
- style: _vipTextStyle(isHighlight: true),
- ),
- TextSpan(text: StringName.memberCardNoVipDesc, style: _vipTextStyle()),
- ];
- }
- // 统一的会员状态文本样式
- TextStyle _vipTextStyle({bool isHighlight = false}) {
- return TextStyle(
- color: isHighlight ? const Color(0xFFFFD273) : Colors.white,
- fontSize: 12.sp,
- fontWeight: FontWeight.w400,
- );
- }
- Widget _buildGoodsCard() {
- return Container(
- margin: EdgeInsets.symmetric(horizontal: 16.w),
- padding: EdgeInsets.only(
- top: 16.h,
- left: 16.w,
- right: 16.w,
- bottom: 24.h,
- ),
- decoration: BoxDecoration(
- color: Colors.white,
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(16.r),
- topRight: Radius.circular(16.r),
- ),
- ),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.start,
- children: [
- Assets.images.iconGoodsInfoTitle.image(
- width: 115.w,
- fit: BoxFit.cover,
- ),
- SizedBox(height: 16.h),
- Obx(() {
- return Column(
- children:
- controller.filteredGoodsList.mapIndexed((index, item) {
- return Obx(() {
- return GestureDetector(
- onTap: () => controller.onGoodsItemClick(item),
- child:
- PlatformUtil.isIOS
- ? _buildGoodsItemIos(
- index,
- item,
- controller.selectedGoodsInfoItem?.id ==
- item.id,
- )
- : _buildGoodsItem(
- item,
- controller.selectedGoodsInfoItem?.id ==
- item.id,
- ),
- );
- });
- }).toList(),
- );
- }),
- // iOS平台的产品描述
- if (PlatformUtil.isIOS) _buildVipDesc(),
- // 非iOS平台,才有支付宝支付和微信支付
- if (!PlatformUtil.isIOS) _buildPayWayCard(),
- ],
- ),
- );
- }
- Widget _buildPayWayCard() {
- return GestureDetector(
- onTap: () => controller.clickPayWaySwitch(),
- child: Container(
- height: 36.h,
- padding: EdgeInsets.symmetric(horizontal: 10.w),
- decoration: ShapeDecoration(
- shape: RoundedRectangleBorder(
- side: BorderSide(width: 1, color: const Color(0xFFECEBE0)),
- borderRadius: BorderRadius.circular(10.r),
- ),
- ),
- child: Row(
- children: [
- Text(
- StringName.storePayWay,
- style: Styles.getTextStyleBlack204W400(14.sp),
- ),
- const Spacer(),
- Obx(() {
- if (controller.selectedPayWay == null) {
- return SizedBox.shrink();
- }
- return Row(
- children: [
- Image.asset(
- getPaymentIconPath(
- payMethod: controller.selectedPayWay!.payMethod,
- payPlatform: controller.selectedPayWay!.payPlatform,
- ),
- width: 20.w,
- height: 20.w,
- ),
- SizedBox(width: 4.w),
- Text(
- controller.selectedPayWay?.title ?? '',
- style: Styles.getTextStyleBlack204W400(14.sp),
- ),
- SizedBox(width: 6.w),
- Assets.images.iconStoreSwitchPay.image(
- width: 20.w,
- height: 20.w,
- fit: BoxFit.fill,
- ),
- ],
- );
- }),
- ],
- ),
- ),
- );
- }
- /// 商品-iOS端
- Widget _buildGoodsItemIos(int index, GoodsInfo item, bool isSelected) {
- // 第一个商品,才有有倒计时
- bool hasCountdown = index == 0;
- Widget contentWidget = Stack(
- children: [
- Positioned(
- left: 16.w,
- top: 0,
- right: 0,
- bottom: 0,
- child: Row(
- children: [
- // 价格
- RichText(
- text: TextSpan(
- children: [
- TextSpan(
- text: '¥',
- style: Styles.getTextStyleFF663300W700(14.sp),
- ),
- TextSpan(
- text: item.amountText,
- style: Styles.getTextStyleFF663300W700(18.sp),
- ),
- ],
- ),
- ),
- SizedBox(width: 18.w),
- // 名称和描述
- Column(
- // 垂直居中
- mainAxisAlignment: MainAxisAlignment.center,
- // 水平左对齐
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- // 名称
- Text(
- item.name,
- style: Styles.getTextStyleFF663300W500(15.sp),
- ),
- // 描述
- if (item.mostDesc?.isNotEmpty == true)
- AutoSizeText(
- item.mostDesc!,
- style: TextStyle(
- color: Color(0x99673300),
- fontSize: 12.sp,
- fontWeight: FontWeight.w500,
- letterSpacing: -0.60,
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- // 最小字体
- minFontSize: 8,
- // 缩小步长,越小越丝滑
- stepGranularity: 0.5,
- ),
- ],
- ),
- ],
- ),
- ),
- // 勾选状态
- Positioned(
- top: 0,
- right: 22.w,
- bottom: 0,
- child: Image(
- image:
- isSelected
- ? Assets.images.iconStoreGoodsSelectedSymbolIos.provider()
- : Assets.images.iconStoreGoodsNormalSymbolIos.provider(),
- width: 20.w,
- height: 20.w,
- ),
- ),
- // 倒计时
- Positioned(
- top: 0,
- right: 8,
- child: Visibility(
- visible: hasCountdown,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Text(
- "倒计时",
- style: TextStyle(
- color: isSelected ? Color(0xFFFFECBB) : Color(0xFFFF9416),
- fontSize: 12.sp,
- fontWeight: FontWeight.w500,
- ),
- ),
- SizedBox(width: 4.w),
- Container(
- margin: EdgeInsets.only(top: 2.5.h),
- child: Obx(() {
- return Text(
- CountdownTimer.format(controller.goodsCountdown.value),
- style: TextStyle(
- color: isSelected ? ColorName.white : Color(0xFFFF9416),
- fontSize: 12.sp,
- fontWeight: FontWeight.w500,
- ),
- );
- }),
- ),
- ],
- ),
- ),
- ),
- ],
- );
- // 最终呈现的内容组件
- Widget resultWidget;
- if (hasCountdown) {
- // 有倒计时的商品,不规则,使用图片背景
- resultWidget = Container(
- decoration: BoxDecoration(
- image: DecorationImage(
- image:
- isSelected
- ? Assets.images.bgStoreGoodsItemWithCountdownSelectedIos
- .provider()
- : Assets.images.bgStoreGoodsItemWithCountdownNormalIos
- .provider(),
- fit: BoxFit.fill,
- ),
- ),
- child: contentWidget,
- );
- } else {
- // 没有倒计时的商品
- resultWidget = Container(
- decoration: BoxDecoration(
- shape: BoxShape.rectangle,
- borderRadius: BorderRadius.circular(8.r),
- border: Border.all(
- color: isSelected ? Color(0xFFFF9416) : Color(0xFFFEE86B),
- width: 2.w,
- ),
- ),
- child: contentWidget,
- );
- }
- // 最后面背景透出来的颜色
- Decoration bgDecoration;
- if (isSelected) {
- // 渐变背景
- bgDecoration = ShapeDecoration(
- gradient: LinearGradient(
- begin: Alignment(-0.06, 0.50),
- end: Alignment(1.14, 0.50),
- colors: [const Color(0xFFFFF895), const Color(0xFFFFE941)],
- ),
- shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(8.r)),
- );
- } else {
- // 纯色背景
- bgDecoration = BoxDecoration(
- color: Color(0xFFFFFEEE),
- borderRadius: BorderRadius.circular(6.r),
- );
- }
- return Container(
- margin: EdgeInsets.only(bottom: 8.h),
- width: 296.w,
- height: 70.h,
- decoration: bgDecoration,
- child: Stack(
- children: [
- // 对勾图片
- Positioned(
- top: 0,
- right: 0,
- bottom: 0,
- child: Assets.images.bgStoreSelectedArrow1Ios.image(
- width: 85.w,
- height: double.infinity,
- ),
- ),
- resultWidget,
- ],
- ),
- );
- }
- /// 商品-Android端
- Widget _buildGoodsItem(GoodsInfo item, bool isSelected) {
- return Container(
- margin: EdgeInsets.only(bottom: 8.h),
- width: 296.w,
- height: 70.h,
- decoration: ShapeDecoration(
- gradient: LinearGradient(
- begin: Alignment(0.77, -0.00),
- end: Alignment(0.77, 1.00),
- colors:
- isSelected
- ? [const Color(0xFFFF9416), const Color(0xFFFF7813)]
- : [const Color(0xFFFEE057), const Color(0xFFFFC400)],
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(10.r),
- ),
- ),
- child: Row(
- children: [
- Container(
- width: 212.w,
- height: 70.h,
- decoration: ShapeDecoration(
- gradient:
- isSelected
- ? LinearGradient(
- begin: Alignment(-0.06, 0.50),
- end: Alignment(1.14, 0.50),
- colors: [
- const Color(0xFFFFF895),
- const Color(0xFFFFE941),
- ],
- )
- : null,
- color: isSelected ? null : const Color(0xFFFFFDEE),
- shape: RoundedRectangleBorder(
- side: BorderSide(width: 1, color: const Color(0xFFFEE86B)),
- borderRadius: BorderRadius.circular(isSelected ? 8 : 10.r),
- ),
- ),
- child: Stack(
- children: [
- if (isSelected)
- IgnorePointer(
- child: Assets.images.bgStoreSelectedItem.image(
- width: 212.w,
- height: 70.h,
- fit: BoxFit.fill,
- ),
- ),
- Padding(
- padding: EdgeInsets.only(left: 16.w),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- mainAxisAlignment: MainAxisAlignment.center,
- children: [
- Row(
- children: [
- RichText(
- text: TextSpan(
- children: [
- TextSpan(
- text: '¥',
- style: Styles.getTextStyleFF663300W700(14.sp),
- ),
- TextSpan(
- text: item.priceDescNumber,
- style: Styles.getTextStyleFF663300W700(18.sp),
- ),
- TextSpan(
- text: item.priceDescUnit,
- style: Styles.getTextStyleFF663300W400(13.sp),
- ),
- ],
- ),
- ),
- if (item.mostDesc?.isNotEmpty == true)
- Container(
- constraints: BoxConstraints(
- minHeight: 20.w,
- maxHeight: 20.w,
- minWidth: 40.w,
- maxWidth: 120.w,
- ),
- padding: EdgeInsets.only(
- left: 16.w,
- top: 2.h,
- bottom: 2.h,
- right: 4.w,
- ),
- decoration: BoxDecoration(
- image: DecorationImage(
- image: Assets.images.iconStoreMost.provider(),
- fit: BoxFit.fill,
- alignment: Alignment.bottomLeft,
- ),
- ),
- child: AutoSizeText(
- item.mostDesc!,
- style: TextStyle(
- color: Colors.white,
- fontSize: 12.sp,
- fontWeight: FontWeight.w500,
- letterSpacing: -0.60,
- ),
- maxLines: 1,
- overflow: TextOverflow.ellipsis,
- minFontSize: 8,
- // 最小字体
- stepGranularity: 0.5, // 缩小步长,越小越丝滑
- ),
- ),
- ],
- ),
- Text(
- item.description!,
- style: Styles.getTextStyle99673300W400(12.sp),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- // 右侧
- Expanded(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Text(
- item.name,
- style:
- isSelected
- ? Styles.getTextStyleFFECBBW500(15.sp)
- : Styles.getTextStyleFF663300W500(15.sp),
- ),
- Container(
- padding: EdgeInsets.symmetric(horizontal: 8.w),
- decoration: ShapeDecoration(
- color: isSelected ? const Color(0xFFFFECBB) : null,
- gradient:
- isSelected
- ? null
- : LinearGradient(
- begin: Alignment(0.77, -0.00),
- end: Alignment(0.77, 1.00),
- colors: [
- const Color(0xFFFF9416),
- const Color(0xFFFF7813),
- ],
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(
- isSelected ? 17.r : 10.r,
- ),
- ),
- ),
- child: Text(
- '¥${item.amountText}',
- textAlign: TextAlign.center,
- style:
- isSelected
- ? Styles.getTextStyleFF7F14W500(12.sp)
- : Styles.getTextStyleWhiteW500(12.sp),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- );
- }
- /// 最后的底部圆角
- Widget _buildLastBottomCorner({required Widget child}) {
- return Container(
- alignment: Alignment.centerLeft,
- margin: EdgeInsets.symmetric(horizontal: 16.w),
- padding: EdgeInsets.symmetric(horizontal: PlatformUtil.isIOS ? 4.w : 16.w),
- width: double.infinity,
- decoration: ShapeDecoration(
- gradient: LinearGradient(
- begin: Alignment(0.00, 0.50),
- end: Alignment(1.00, 0.50),
- colors: [const Color(0x7FFFF3A3), const Color(0x21FFF3A3)],
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.only(
- bottomLeft: Radius.circular(20.r),
- bottomRight: Radius.circular(20.r),
- ),
- ),
- shadows: [
- BoxShadow(
- color: Colors.black.withAlpha(10),
- blurRadius: 10.r,
- spreadRadius: 0.r,
- offset: Offset(0, 8.r),
- ),
- ],
- ),
- child: Column(
- child: child,
- );
- }
- /// 产品描述
- Widget _buildVipDesc() {
- return Obx(() {
- return Text(
- controller.selectedGoodsInfoItem?.selectDesc ?? "",
- style: Styles.getTextStyle99673300W400(12.sp),
- );
- });
- }
- // 轮播图
- Widget _buildBanner(BuildContext context) {
- return SizedBox(
- width: double.infinity,
- child: Stack(
- children: [
- CarouselSlider(
- carouselController: controller.carouselSliderController,
- options: CarouselOptions(
- height: 280.h,
- viewportFraction: 1,
- initialPage: 0,
- enableInfiniteScroll: true,
- reverse: false,
- autoPlay: true,
- autoPlayInterval: const Duration(seconds: 3),
- autoPlayAnimationDuration: const Duration(milliseconds: 800),
- autoPlayCurve: Curves.fastOutSlowIn,
- scrollDirection: Axis.horizontal,
- onPageChanged: (index, reason) {
- controller.onBannerChanged(index, reason);
- },
- ),
- items:
- controller.bannerList.map((item) {
- return item.banner.image(
- width: double.infinity,
- fit: BoxFit.cover,
- );
- }).toList(),
- ),
- Positioned(bottom: 0, left: 0, right: 0, child: _buildIndicator()),
- ],
- ),
- );
- }
- // 指示器
- _buildIndicator() {
- return Container(
- height: 36.h,
- margin: EdgeInsets.symmetric(horizontal: 16.w),
- decoration: ShapeDecoration(
- color: const Color(0xE5121212),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(21.r),
- ),
- ),
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children:
- controller.bannerList
- .asMap()
- .entries
- .map((entry) {
- return Obx(() {
- final isSelectedBanner =
- controller.currentBannerIndex == entry.key;
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: [
- GestureDetector(
- onTap:
- () =>
- controller.carouselSliderController
- .animateToPage(entry.key),
- child: SizedBox(
- width: 100.w,
- child: Stack(
- alignment: Alignment.center,
- clipBehavior: Clip.none,
- children: [
- if (isSelectedBanner)
- Positioned(
- top: -8.h,
- child: controller
- .bannerList[entry.key]
- .indicatorImg
- .image(
- width: 100.w,
- height: 40.h,
- fit: BoxFit.fill,
- ),
- )
- else
- Text(
- controller.bannerList[entry.key].unSelectedDesc,
- style: Styles.getTextStyleWhiteW400(14.sp),
- ),
- ],
- ),
- ),
- ),
- if (entry.key != controller.bannerList.length - 1)
- Padding(
- padding: EdgeInsets.only(left: 4.w),
- child: Assets.images.iconStoreDivider.image(
- width: 2.w,
- height: 17.h,
- fit: BoxFit.fill,
- ),
- ),
- ],
- );
- });
- }).toList(),
- ),
- );
- }
- Widget _buildUserReviews() {
- return Container(
- width: double.infinity,
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: [
- Assets.images.iconStoreUserReviewsTitle.image(
- width: 240.w,
- fit: BoxFit.cover,
- ),
- SizedBox(height: 16.h),
- Container(
- width: double.infinity,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(19.r),
- gradient: LinearGradient(
- begin: Alignment.topCenter,
- end: Alignment.bottomCenter,
- colors: [Colors.white, Color(0xfffff8d4)],
- ),
- ),
- child: Column(
- children: [
- SizedBox(height: 20.h),
- Container(
- width: 326.w,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.circular(19.r),
- image: DecorationImage(
- alignment: Alignment.topCenter,
- image: Assets.images.bgStoreUserReviews.provider(),
- fit: BoxFit.contain,
- ),
- ),
- child: Column(
- children: [
- Container(
- padding: EdgeInsets.only(left: 16.w),
- alignment: Alignment.centerLeft,
- height: 39.h,
- child: Assets.images.iconStoreUserReviewsLogo.image(
- width: 92.w,
- height: 24.h,
- ),
- ),
- Container(
- width: 326.w,
- decoration: ShapeDecoration(
- color: Colors.white,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(16.r),
- ),
- shadows: [
- BoxShadow(
- color: Colors.black.withAlpha(10),
- blurRadius: 10.r,
- spreadRadius: 0.r,
- offset: Offset(0, 5.r),
- ),
- ],
- ),
- child: Column(
- children:
- controller.userReviewsList.map((item) {
- return _buildReviewsItem(item);
- }).toList(),
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ],
- ),
- );
- }
- Widget _buildReviewsItem(StoreUserReviewsBean item) {
- return Container(
- padding: EdgeInsets.only(left: 16.w, right: 16.w, top: 12.h),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Row(
- children: [
- item.avatar.image(width: 28.w, height: 28.h, fit: BoxFit.cover),
- SizedBox(width: 10.w),
- Text(
- item.userName,
- style: Styles.getTextStyleBlack204W500(14.sp),
- ),
- SizedBox(width: 6.w),
- Assets.images.iconStorePermanentMember.image(
- width: 70.w,
- height: 20.h,
- fit: BoxFit.cover,
- ),
- ],
- ),
- SizedBox(height: 4.h),
- Padding(
- padding: EdgeInsets.only(left: 38.w),
- child: Text(
- item.userReviews,
- style: TextStyle(
- color: Colors.black.withAlpha(153),
- fontSize: 12.sp,
- fontWeight: FontWeight.w400,
- ),
- ),
- ),
- SizedBox(height: 12.h),
- if (controller.userReviewsList.indexOf(item) !=
- controller.userReviewsList.length - 1)
- HorizontalDashedLine(
- width: 304.w,
- color: const Color(0XFFEDEBE1),
- strokeWidth: 2.h,
- dashLength: 4.w,
- dashSpace: 4.w,
- ),
- ],
- ),
- );
- }
- // 用户须知
- Widget _buildUserNotice() {
- return Container(
- margin: EdgeInsets.symmetric(horizontal: 16.w),
- decoration: BoxDecoration(borderRadius: BorderRadius.circular(16.r)),
- child: Column(
- crossAxisAlignment: CrossAxisAlignment.start,
- children: [
- Text('购买须知', style: Styles.getTextStyleFF663300W400(12.sp)),
- SizedBox(height: 8.h),
- Obx(() {
- return Text(
- controller.configRepository.memberTips.value,
- style: Styles.getTextStyle99673300W400(10.sp),
- );
- }),
- SizedBox(height: 150.h),
- ],
- ),
- );
- }
- /// 恢复订阅
- Widget _buildRecoverSubscribe() {
- return Container(
- margin: EdgeInsets.only(left: 16.w, top: 8.h, right: 16.w),
- child: Row(
- children: [
- Text(
- "⚠️ 订阅未生效?点此试试",
- style: TextStyle(
- color: Color(0xFF666355),
- fontSize: 13.sp,
- fontWeight: FontWeight.w400,
- ),
- ),
- GestureDetector(
- onTap: () {
- // 恢复订阅
- controller.clickRecoverSubscribe();
- },
- child: Text(
- " 恢复订阅>",
- style: TextStyle(
- color: Color(0xFF479DF7),
- fontSize: 13.sp,
- fontWeight: FontWeight.w400,
- ),
- ),
- ),
- ],
- ),
- );
- }
- Widget _buildBuyButtonCard() {
- return Container(
- width: 360.w,
- padding: EdgeInsets.symmetric(horizontal: 16.w, vertical: 11.h),
- decoration: ShapeDecoration(
- color: Colors.white,
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.only(
- topLeft: Radius.circular(24.r),
- topRight: Radius.circular(24.r),
- ),
- ),
- shadows: [
- BoxShadow(
- color: Color(0x99FFE498),
- blurRadius: 20,
- offset: Offset(0, 0),
- spreadRadius: 0,
- ),
- ],
- ),
- child: Column(
- children: [
- GestureDetector(
- onTap: controller.clickPayNow,
- child: Container(
- alignment: Alignment.topCenter,
- width: 328.w,
- height: 56.w,
- decoration: ShapeDecoration(
- color: const Color(0xFFFFF587),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(30.55.r),
- ),
- ),
- child: Container(
- width: 328.w,
- height: 54.w,
- decoration: ShapeDecoration(
- gradient: LinearGradient(
- begin: Alignment(0.60, -0.39),
- end: Alignment(0.60, 0.95),
- colors: [
- const Color(0xFFF95FAC),
- const Color(0xFFFD5E4D),
- const Color(0xFFFD5E4D),
- const Color(0xFFFB8A3C),
- ],
- ),
- shape: RoundedRectangleBorder(
- borderRadius: BorderRadius.circular(30.55.r),
- ),
- ),
- child: Center(
- child: Text(
- StringName.storePayNow,
- style: Styles.getTextStyleWhiteW500(17.sp),
- ),
- ),
- ),
- ),
- ),
- // 安卓平台的隐私协议和服务条款
- if (!PlatformUtil.isIOS) _buildPrivacy(),
- ],
- ),
- );
- }
- /// 隐私协议和服务条款
- Widget _buildPrivacy({
- Color privacyColor = const Color(0xFF459FFF),
- MainAxisAlignment mainAxisAlignment = MainAxisAlignment.center,
- }) {
- return Row(
- mainAxisAlignment: mainAxisAlignment,
- children: [
- Obx(() {
- return GestureDetector(
- behavior: HitTestBehavior.opaque,
- onTap: () {
- controller.isAgree.value = !controller.isAgree.value;
- },
- child: Padding(
- padding: EdgeInsets.symmetric(vertical: 10.w, horizontal: 10.w),
- child:
- controller.isAgree.value
- ? Assets.images.iconStoreAgreePrivacy.image(
- width: 16.w,
- height: 16.w,
- )
- : SizedBox(
- child: Container(
- padding: EdgeInsets.all(1.w),
- width: 16.w,
- height: 16.w,
- child: Container(
- decoration: BoxDecoration(
- shape: BoxShape.circle,
- border: Border.all(
- color: Colors.black.withAlpha(153),
- width: 1.w,
- ),
- ),
- ),
- ),
- ),
- ),
- );
- }),
- Transform.translate(
- offset: Offset(-2.w, 0),
- child: Text.rich(
- PlatformUtil.isIOS
- ? TextSpan(
- children: [
- TextSpan(
- text: StringName.textSpanIHaveReadAndAgree,
- style: TextStyle(
- color: Colors.black.withAlpha(153),
- fontSize: 10.sp,
- fontWeight: FontWeight.w400,
- ),
- ),
- ClickTextSpan(
- text: StringName.textSpanPrivacyPolicy,
- url: WebUrl.privacyPolicy,
- color: privacyColor,
- ),
- ClickTextSpan(
- text: StringName.textSpanServiceTerms,
- url: WebUrl.serviceAgreement,
- color: privacyColor,
- ),
- TextSpan(
- text: StringName.textSpanAnd,
- style: TextStyle(
- color: Colors.black.withAlpha(153),
- fontSize: 10.sp,
- fontWeight: FontWeight.w400,
- ),
- ),
- ClickTextSpan(
- text: StringName.textSpanMemberAgreement,
- url: WebUrl.subscribeAgreement,
- color: privacyColor,
- ),
- ],
- )
- : TextSpan(
- children: [
- TextSpan(
- text: StringName.textSpanIHaveReadAndAgree,
- style: TextStyle(
- color: Colors.black.withAlpha(153),
- fontSize: 10.sp,
- fontWeight: FontWeight.w400,
- ),
- ),
- ClickTextSpan(
- text: StringName.textSpanPrivacyPolicy,
- url: WebUrl.privacyPolicy,
- color: privacyColor,
- ),
- TextSpan(
- text: StringName.textSpanAnd,
- style: TextStyle(
- color: Colors.black.withAlpha(153),
- fontSize: 10.sp,
- fontWeight: FontWeight.w400,
- ),
- ),
- ClickTextSpan(
- text: StringName.textSpanServiceTerms,
- url: WebUrl.serviceAgreement,
- color: privacyColor,
- ),
- ],
- ),
- ),
- ),
- ],
- );
- }
- }
|