From 66a176bbd3525bafe6f577b740f670a4bf1f8048 Mon Sep 17 00:00:00 2001 From: PH2 <1293456824@qq.com> Date: Mon, 18 Jan 2021 14:10:34 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=95=86=E5=93=81=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E7=9A=84=E5=85=A8=E9=83=A8=E4=BF=AE=E6=94=B9=E5=AE=8C=E6=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/register.dart | 4 +- .../model/goods_details_evaluate_model.dart | 6 +- .../footer/goods_details_footer_widget.dart | 19 ++- .../goods_details_slide_banner_widget.dart | 29 ++-- .../goods_details_silde_banner_model.dart | 147 ++++++++++++++---- .../goods_details/store/store_widget.dart | 2 +- .../title/goods_details_title_widget.dart | 2 +- .../model/goods_details_title_model.dart | 8 + .../upgrade_tip/model/upgrade_tip_model.dart | 4 + .../upgrade_tip/upgrade_tip_widget.dart | 6 +- 10 files changed, 170 insertions(+), 57 deletions(-) diff --git a/lib/register.dart b/lib/register.dart index 50f50d3..ff8fdea 100644 --- a/lib/register.dart +++ b/lib/register.dart @@ -340,8 +340,8 @@ class BaseWidgetRegister { WidgetFactory.regist('product_detail_image', DefaultWidgetCreater((model) => GoodsDetailsImgWidget(model))); // 商品推荐列表的小标题 WidgetFactory.regist('product_detail_recommend_title', DefaultWidgetCreater((model) => GoodsDetailsRecommendTitleWidget(model))); - // 商品详情底部推荐列表 - WidgetFactory.regist('product_detail_bottom_rec', GoodsDetailCommendCreater()); + // 商品详情底部推荐列表(改用首页的商品列表了) + // WidgetFactory.regist('product_detail_bottom_rec', GoodsDetailCommendCreater()); // 商品详情底部 WidgetFactory.regist('product_detail_bottom', DefaultWidgetCreater((model) => GoodsDetailsFooterWidget(model))); diff --git a/lib/widgets/goods_details/evaluate/model/goods_details_evaluate_model.dart b/lib/widgets/goods_details/evaluate/model/goods_details_evaluate_model.dart index 5ce72dd..22f5ae3 100644 --- a/lib/widgets/goods_details/evaluate/model/goods_details_evaluate_model.dart +++ b/lib/widgets/goods_details/evaluate/model/goods_details_evaluate_model.dart @@ -21,6 +21,7 @@ class GoodsDetailsEvaluateModel { String titleIcon; String moreText; String moreIcon; + String moreTextColor; GoodsDetailsEvaluateModel({ this.comment_url, @@ -43,7 +44,8 @@ class GoodsDetailsEvaluateModel { this.titleColor, this.titleIcon, this.moreText, - this.moreIcon + this.moreIcon, + this.moreTextColor, }); GoodsDetailsEvaluateModel.fromJson(Map<String, dynamic> json) { @@ -70,6 +72,7 @@ class GoodsDetailsEvaluateModel { titleIcon = json['title_icon']; moreText = json['more_text']; moreIcon = json['more_icon']; + moreTextColor = json['more_text_color']; } Map<String, dynamic> toJson() { @@ -97,6 +100,7 @@ class GoodsDetailsEvaluateModel { data['title_icon'] = this.titleIcon; data['more_text'] = this.moreText; data['more_icon'] = this.moreIcon; + data['more_text_color'] = this.moreText; return data; } diff --git a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart index ce0f22e..02a51be 100644 --- a/lib/widgets/goods_details/footer/goods_details_footer_widget.dart +++ b/lib/widgets/goods_details/footer/goods_details_footer_widget.dart @@ -7,6 +7,7 @@ import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:fluttertoast/fluttertoast.dart'; import 'package:provider/provider.dart'; import 'package:zhiying_base_widget/pages/goods_share_page/goods_share_page.dart'; +import 'package:zhiying_base_widget/widgets/custom/multi_nav/cached_network_image_util.dart'; import 'package:zhiying_base_widget/widgets/goods_details/footer/bloc/goods_details_footer_bloc.dart'; import 'package:zhiying_base_widget/widgets/goods_details/footer/bloc/goods_details_footer_repository.dart'; import 'package:zhiying_base_widget/widgets/goods_details/footer/goods_details_footer_sk.dart'; @@ -210,10 +211,11 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain width: 110, // padding: const EdgeInsets.only(left: 30, right: 30, top: 5, bottom: 5), decoration: BoxDecoration( - gradient: LinearGradient( - colors: [HexColor.fromHex(/*model?.share_earn_bg1_color ??*/ '#FFCA66'), HexColor.fromHex(/*model?.share_earn_bg2_color ??*/ '#FFD961')], - begin: Alignment.centerLeft, - end: Alignment.centerRight), + // gradient: LinearGradient( + // colors: [HexColor.fromHex(/*model?.share_earn_bg1_color ??*/ '#FFCA66'), HexColor.fromHex(/*model?.share_earn_bg2_color ??*/ '#FFD961')], + // begin: Alignment.centerLeft, + // end: Alignment.centerRight), + image: DecorationImage(image: CachedNetworkImageProvider(model?.listStyle?.rightIcon1?.bgImage ?? ''), fit: BoxFit.fitWidth), borderRadius: BorderRadius.only(bottomLeft: Radius.circular(25), topLeft: Radius.circular(25))), child: Column( crossAxisAlignment: CrossAxisAlignment.center, @@ -248,10 +250,11 @@ class _GoodsDetailsFooterContainerState extends State<_GoodsDetailsFooterContain height: 44, width: 110, decoration: BoxDecoration( - gradient: LinearGradient( - colors: [HexColor.fromHex(/*model?.save_earn_bg1_color ??*/ '#FF6969'), HexColor.fromHex(/*model?.save_earn_bg2_color ??*/ '#FF4646')], - begin: Alignment.centerLeft, - end: Alignment.centerRight), + // gradient: LinearGradient( + // colors: [HexColor.fromHex(/*model?.save_earn_bg1_color ??*/ '#FF6969'), HexColor.fromHex(/*model?.save_earn_bg2_color ??*/ '#FF4646')], + // begin: Alignment.centerLeft, + // end: Alignment.centerRight), + image: DecorationImage(image: CachedNetworkImageProvider(model?.listStyle?.rightIcon2?.bgImage ?? ''), fit: BoxFit.fitWidth), borderRadius: BorderRadius.only(bottomRight: Radius.circular(25), topRight: Radius.circular(25))), child: Column( crossAxisAlignment: CrossAxisAlignment.center, diff --git a/lib/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart b/lib/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart index 9970fe4..7c3c135 100644 --- a/lib/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart +++ b/lib/widgets/goods_details/slide_banner/goods_details_slide_banner_widget.dart @@ -48,8 +48,7 @@ class _GoodsDetailsSlideBannerContainerState void _itemOnClick(String model, List<String> images, int index) { print('点击了 $model'); if (images != null) { - PhotoPreview.showPhotoPreviewByimages(context, images, - currentIndex: index, heroTagSuffix: "top"); + PhotoPreview.showPhotoPreviewByimages(context, images, currentIndex: index, heroTagSuffix: "top"); } } @@ -103,6 +102,16 @@ class _GoodsDetailsSlideBannerContainerState Widget _getMainWidget(GoodsDetailsSlideBannerModel datas) { return Container( width: double.infinity, + margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(datas?.topMargin), left: ParseUtil.stringParseDouble(datas?.leftRightMargin), right: ParseUtil.stringParseDouble(datas?.leftRightMargin)), + decoration: BoxDecoration( + color: HexColor.fromHex(datas?.bgColor), + borderRadius: BorderRadius.only( + topRight: Radius.circular(ParseUtil.stringParseDouble(datas?.topRightRadius)), + topLeft: Radius.circular(ParseUtil.stringParseDouble(datas?.topLeftRadius)), + bottomLeft: Radius.circular(ParseUtil.stringParseDouble(datas?.bottomLeftRadius)), + bottomRight: Radius.circular(ParseUtil.stringParseDouble(datas?.bottomRightRadius)), + ) + ), height: MediaQuery.of(context).size.width, child: Swiper( controller: _control, @@ -150,20 +159,20 @@ class _GoodsDetailsSlideBannerContainerState /// 获取进度样式 SwiperPlugin _getSwiperStyleByType( GoodsDetailsSlideBannerModel model, int pageCount) { - if ('1' != model.pagination_open) { - return null; - } + // if ('1' != model.pagination_open) { + // return null; + // } if ('type_number' == model.pagination) { - return _getNumswiperPlugin(pageCount, model.pagination_select_color, - model.pagination_unselect_color); + return _getNumswiperPlugin(pageCount, model.paginationSelectColor, + model.paginationUnselectColor); } if ('type_point' == model.pagination) { return _swiperCustomPaginationDito(pageCount, - model.pagination_select_color, model.pagination_unselect_color); + model.paginationSelectColor, model.paginationUnselectColor); } if ('type_bar' == model.pagination) { - return _swiperCustomPagination(pageCount, model.pagination_select_color, - model.pagination_unselect_color); + return _swiperCustomPagination(pageCount, model.paginationSelectColor, + model.paginationUnselectColor); } return null; } diff --git a/lib/widgets/goods_details/slide_banner/model/goods_details_silde_banner_model.dart b/lib/widgets/goods_details/slide_banner/model/goods_details_silde_banner_model.dart index c02e769..fe17a02 100644 --- a/lib/widgets/goods_details/slide_banner/model/goods_details_silde_banner_model.dart +++ b/lib/widgets/goods_details/slide_banner/model/goods_details_silde_banner_model.dart @@ -1,36 +1,121 @@ class GoodsDetailsSlideBannerModel { - List<String> image_list; - String pagination; - String pagination_open; - List<String> pagination_options; - String pagination_select_color; - String pagination_unselect_color; + List<String> image_list; - GoodsDetailsSlideBannerModel({this.image_list, this.pagination, this.pagination_open, this.pagination_options, this.pagination_select_color, this.pagination_unselect_color}); + String name; + String desc; + String pagination; + String moduleType; + String moduleKey; + String isTopMargin; + String isLeftRightMargin; + String isShow; + String carouselType; + String paginationSelectColor; + String paginationUnselectColor; + String barWidthHeightRatio; + String bgWidthHeightRatio; + String carouselTime; + String topMargin; + String leftRightMargin; + String topLeftRadius; + String topRightRadius; + String bottomLeftRadius; + String bottomRightRadius; + String bgColor; + String hasVideo; + // List<Null> indexCarouselList; - factory GoodsDetailsSlideBannerModel.fromJson(Map<String, dynamic> json) { - return GoodsDetailsSlideBannerModel( - image_list: json['image_list'] != null ? new List<String>.from(json['image_list']) : null, - pagination: json['pagination'], - pagination_open: json['pagination_open'], - pagination_options: json['pagination_options'] != null ? new List<String>.from(json['pagination_options']) : null, - pagination_select_color: json['pagination_select_color'], - pagination_unselect_color: json['pagination_unselect_color'], - ); - } + GoodsDetailsSlideBannerModel({ + this.image_list, + this.name, + this.desc, + this.pagination, + this.moduleType, + this.moduleKey, + this.isTopMargin, + this.isLeftRightMargin, + this.isShow, + this.carouselType, + this.paginationSelectColor, + this.paginationUnselectColor, + this.barWidthHeightRatio, + this.bgWidthHeightRatio, + this.carouselTime, + this.topMargin, + this.leftRightMargin, + this.topLeftRadius, + this.topRightRadius, + this.bottomLeftRadius, + this.bottomRightRadius, + this.bgColor, + this.hasVideo, + // this.indexCarouselList, + }); + + GoodsDetailsSlideBannerModel.fromJson(Map<String, dynamic> json) { + image_list = json['image_list'] != null ? new List<String>.from(json['image_list']) : null; + + name = json['name']; + desc = json['desc']; + pagination = json['pagination']; + moduleType = json['module_type']; + moduleKey = json['module_key']; + isTopMargin = json['is_top_margin']; + isLeftRightMargin = json['is_left_right_margin']; + isShow = json['is_show']; + carouselType = json['carousel_type']; + paginationSelectColor = json['pagination_select_color']; + paginationUnselectColor = json['pagination_unselect_color']; + barWidthHeightRatio = json['bar_width_height_ratio']; + bgWidthHeightRatio = json['bg_width_height_ratio']; + carouselTime = json['carousel_time']; + topMargin = json['top_margin']; + leftRightMargin = json['left_right_margin']; + topLeftRadius = json['top_left_radius']; + topRightRadius = json['top_right_radius']; + bottomLeftRadius = json['bottom_left_radius']; + bottomRightRadius = json['bottom_right_radius']; + bgColor = json['bg_color']; + hasVideo = json['has_video']; + // if (json['index_carousel_list'] != null) { + // indexCarouselList = new List<Null>(); + // json['index_carousel_list'].forEach((v) { + // indexCarouselList.add(new Null.fromJson(v)); + // }); + // } + } - Map<String, dynamic> toJson() { - final Map<String, dynamic> data = new Map<String, dynamic>(); - data['pagination'] = this.pagination; - data['pagination_open'] = this.pagination_open; - data['pagination_select_color'] = this.pagination_select_color; - data['pagination_unselect_color'] = this.pagination_unselect_color; - if (this.image_list != null) { - data['image_list'] = this.image_list; - } - if (this.pagination_options != null) { - data['pagination_options'] = this.pagination_options; - } - return data; + Map<String, dynamic> toJson() { + final Map<String, dynamic> data = new Map<String, dynamic>(); + if (this.image_list != null) { + data['image_list'] = this.image_list; } -} \ No newline at end of file + data['name'] = this.name; + data['desc'] = this.desc; + data['pagination'] = this.pagination; + data['module_type'] = this.moduleType; + data['module_key'] = this.moduleKey; + data['is_top_margin'] = this.isTopMargin; + data['is_left_right_margin'] = this.isLeftRightMargin; + data['is_show'] = this.isShow; + data['carousel_type'] = this.carouselType; + data['pagination_select_color'] = this.paginationSelectColor; + data['pagination_unselect_color'] = this.paginationUnselectColor; + data['bar_width_height_ratio'] = this.barWidthHeightRatio; + data['bg_width_height_ratio'] = this.bgWidthHeightRatio; + data['carousel_time'] = this.carouselTime; + data['top_margin'] = this.topMargin; + data['left_right_margin'] = this.leftRightMargin; + data['top_left_radius'] = this.topLeftRadius; + data['top_right_radius'] = this.topRightRadius; + data['bottom_left_radius'] = this.bottomLeftRadius; + data['bottom_right_radius'] = this.bottomRightRadius; + data['bg_color'] = this.bgColor; + data['has_video'] = this.hasVideo; + // if (this.indexCarouselList != null) { + // data['index_carousel_list'] = + // this.indexCarouselList.map((v) => v.toJson()).toList(); + // } + return data; + } +} diff --git a/lib/widgets/goods_details/store/store_widget.dart b/lib/widgets/goods_details/store/store_widget.dart index ea47d6b..7b5d33c 100644 --- a/lib/widgets/goods_details/store/store_widget.dart +++ b/lib/widgets/goods_details/store/store_widget.dart @@ -140,7 +140,7 @@ class _StoreContainerState extends State<StoreContainer> { mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[ /// 商店名称 - Text(model?.shop_name ?? '品胜京东自营旗舰店', + Text(model?.shop_name ?? '', style: TextStyle( color: HexColor.fromHex(model?.shopTextColor ?? '#333333'), fontSize: 13, diff --git a/lib/widgets/goods_details/title/goods_details_title_widget.dart b/lib/widgets/goods_details/title/goods_details_title_widget.dart index 55f1edf..cd6a2b0 100644 --- a/lib/widgets/goods_details/title/goods_details_title_widget.dart +++ b/lib/widgets/goods_details/title/goods_details_title_widget.dart @@ -121,7 +121,7 @@ class GoodsDetailsTitleWidget extends StatelessWidget { if(model?.provider == GlobalConfig.PROVIDER_VIP || model?.provider == GlobalConfig.PROVIDER_KL){ return Container(); } - return Text('${model?.soldCount}人已购买' ?? '99999人已购买', style: TextStyle(color: HexColor.fromHex(/*model?.buy_color ??*/ '#999999'), fontSize: 12.5)); + return Text('${model?.soldCount?? 0}${model?.goBuyText ?? '人已购买'}' ?? '99999人已购买', style: TextStyle(color: HexColor.fromHex(model?.goBuyColor ?? '#999999'), fontSize: 12.5)); } diff --git a/lib/widgets/goods_details/title/model/goods_details_title_model.dart b/lib/widgets/goods_details/title/model/goods_details_title_model.dart index f97b9f9..ba14c0f 100644 --- a/lib/widgets/goods_details/title/model/goods_details_title_model.dart +++ b/lib/widgets/goods_details/title/model/goods_details_title_model.dart @@ -24,6 +24,8 @@ class GoodsDetailsTitleModel { String rewardStr; List<PlatformCss> platformCss; List<String> sourceList; + String goBuyText; + String goBuyColor; String currentPrice; @@ -62,6 +64,8 @@ class GoodsDetailsTitleModel { this.rewardStr, this.platformCss, this.sourceList, + this.goBuyText, + this.goBuyColor, this.currentPrice, this.isCoupon, @@ -105,6 +109,8 @@ class GoodsDetailsTitleModel { }); } sourceList = json['source_list'].cast<String>(); + goBuyText = json['go_buy_text']; + goBuyColor = json['go_buy_text_color']; currentPrice = json['current_price']; isCoupon = json['is_coupon']; @@ -146,6 +152,8 @@ class GoodsDetailsTitleModel { data['platform_css'] = this.platformCss.map((v) => v.toJson()).toList(); } data['source_list'] = this.sourceList; + data['go_buy_text'] = this.goBuyText; + data['go_buy_text_color'] = this.goBuyColor; data['current_price'] = this.currentPrice; data['is_coupon'] = this.isCoupon; diff --git a/lib/widgets/goods_details/upgrade_tip/model/upgrade_tip_model.dart b/lib/widgets/goods_details/upgrade_tip/model/upgrade_tip_model.dart index a81d023..b44c1b2 100644 --- a/lib/widgets/goods_details/upgrade_tip/model/upgrade_tip_model.dart +++ b/lib/widgets/goods_details/upgrade_tip/model/upgrade_tip_model.dart @@ -20,6 +20,7 @@ class UpgradeTipModel { String bottomRightRadius; String bgColor; String bulletinText; + String bulletinBgColor; String bulletinTextColor; String goText; GoSkip goSkip; @@ -41,6 +42,7 @@ class UpgradeTipModel { this.bottomRightRadius, this.bgColor, this.bulletinText, + this.bulletinBgColor, this.bulletinTextColor, this.goText, this.goSkip, @@ -64,6 +66,7 @@ class UpgradeTipModel { bottomRightRadius = json['bottom_right_radius']; bgColor = json['bg_color']; bulletinText = json['bulletin_text']; + bulletinBgColor = json ['bulletin_bg_color']; bulletinTextColor = json['bulletin_text_color']; goText = json['go_text']; goSkip = @@ -90,6 +93,7 @@ class UpgradeTipModel { data['bottom_right_radius'] = this.bottomRightRadius; data['bg_color'] = this.bgColor; data['bulletin_text'] = this.bulletinText; + data['bulletin_bg_color'] = this.bulletinBgColor; data['bulletin_text_color'] = this.bulletinTextColor; data['go_text'] = this.goText; if (this.goSkip != null) { diff --git a/lib/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart b/lib/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart index f6e2349..699ae64 100644 --- a/lib/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart +++ b/lib/widgets/goods_details/upgrade_tip/upgrade_tip_widget.dart @@ -34,8 +34,8 @@ class UpgradeTipWidget extends StatelessWidget { margin: EdgeInsets.only(top: ParseUtil.stringParseDouble(_model?.topMargin), left: ParseUtil.stringParseDouble(_model?.leftRightMargin), right: ParseUtil.stringParseDouble(_model?.leftRightMargin)), padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 6, bottom: 6), decoration: BoxDecoration( - // color: HexColor.fromHex(_model?.bgColor), - color: Colors.white, + color: HexColor.fromHex(_model?.bgColor), + // color: Colors.white, borderRadius: BorderRadius.only( topLeft: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)), topRight: Radius.circular(ParseUtil.stringParseDouble(_model?.topLeftRadius)), @@ -48,7 +48,7 @@ class UpgradeTipWidget extends StatelessWidget { child: Container( decoration: BoxDecoration( /// 背景颜色 - color: HexColor.fromHex(_model?.bgColor ?? '#FFEFDA'), + color: HexColor.fromHex(_model?.bulletinBgColor ?? '#FFEFDA'), borderRadius: BorderRadius.circular(30), ), padding: const EdgeInsets.only(left: 10, right: 13, top: 10, bottom: 10),