| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334 |
- 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 _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 _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 _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(
- margin: EdgeInsets.only(top: PlatformUtil.isIOS ? 0.h : 2.h),
- padding: EdgeInsets.symmetric(vertical: 5.w, horizontal: 5.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,
- ),
- ],
- ),
- ),
- ),
- ],
- );
- }
- }
|