From ecc361779d021daebafc22cd3a42bd6c6a9145bf Mon Sep 17 00:00:00 2001 From: PH2 <1293456824@qq.com> Date: Mon, 12 Apr 2021 18:19:03 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=88=86=E4=BA=AB=E5=86=85=E5=AE=B9?= =?UTF-8?q?=E7=BB=84=E4=BB=B6=E7=9A=84=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/custom_share_content_model.dart | 81 +++++++++++-------- .../share_content/share_content_widget.dart | 65 ++++++++------- 2 files changed, 86 insertions(+), 60 deletions(-) diff --git a/lib/widgets/custom/share_content/model/custom_share_content_model.dart b/lib/widgets/custom/share_content/model/custom_share_content_model.dart index 3cda492..79938aa 100644 --- a/lib/widgets/custom/share_content/model/custom_share_content_model.dart +++ b/lib/widgets/custom/share_content/model/custom_share_content_model.dart @@ -1,6 +1,6 @@ import 'package:zhiying_comm/zhiying_comm.dart'; -class CustomShareContentModel extends SkipModel{ +class CustomShareContentModel extends SkipModel { String name; String desc; String text; @@ -30,37 +30,46 @@ class CustomShareContentModel extends SkipModel{ String textColor; String skipName; String cateTag; + String cardBgColor; + String cardBorderColor; + String scaleImage; + String scaleImageUrl; - CustomShareContentModel( - {this.name, - this.desc, - this.text, - this.moduleType, - this.moduleKey, - this.isTopMargin, - this.isLeftRightMargin, - this.isShow, - this.topMargin, - this.leftRightMargin, - this.topLeftRadius, - this.topRightRadius, - this.bottomLeftRadius, - this.bottomRightRadius, - this.bgColor, - this.isShowShareFriend, - this.bgImage, - this.bgImageUrl, - this.titleImage, - this.titleImageUrl, - this.copyImage, - this.copyImageUrl, - this.copyLongImage, - this.copyLongImageUrl, - this.shareImage, - this.shareImageUrl, - this.textColor, - this.skipName, - this.cateTag}); + CustomShareContentModel({ + this.name, + this.desc, + this.text, + this.moduleType, + this.moduleKey, + this.isTopMargin, + this.isLeftRightMargin, + this.isShow, + this.topMargin, + this.leftRightMargin, + this.topLeftRadius, + this.topRightRadius, + this.bottomLeftRadius, + this.bottomRightRadius, + this.bgColor, + this.isShowShareFriend, + this.bgImage, + this.bgImageUrl, + this.titleImage, + this.titleImageUrl, + this.copyImage, + this.copyImageUrl, + this.copyLongImage, + this.copyLongImageUrl, + this.shareImage, + this.shareImageUrl, + this.textColor, + this.skipName, + this.cateTag, + this.cardBgColor, + this.cardBorderColor, + this.scaleImage, + this.scaleImageUrl, + }); CustomShareContentModel.fromJson(Map json) { super.fromJson(json); @@ -97,6 +106,10 @@ class CustomShareContentModel extends SkipModel{ requiredTaobaoAuth = json['required_taobao_auth']; isJump = json['is_jump']; cateTag = json['cate_tag']; + cardBgColor = json['card_bg_color']; + cardBorderColor = json['card_border_color']; + scaleImage = json['scale_image']; + scaleImageUrl = json['scale_image_url']; } Map toJson() { @@ -134,6 +147,10 @@ class CustomShareContentModel extends SkipModel{ data['required_taobao_auth'] = this.requiredTaobaoAuth; data['is_jump'] = this.isJump; data['cate_tag'] = this.cateTag; + data['card_bg_color'] = this.cardBgColor; + data['card_border_color'] = this.cardBorderColor; + data['scale_image'] = this.scaleImage; + data['scale_image_url'] = this.scaleImageUrl; return data; } -} \ No newline at end of file +} diff --git a/lib/widgets/custom/share_content/share_content_widget.dart b/lib/widgets/custom/share_content/share_content_widget.dart index ac17814..7c0c9a1 100644 --- a/lib/widgets/custom/share_content/share_content_widget.dart +++ b/lib/widgets/custom/share_content/share_content_widget.dart @@ -91,37 +91,46 @@ class _CustomShareContentContainerWidgetState extends State<_CustomShareContentC topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)), topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)), )), - child: Stack( - children: [ - CachedNetworkImage(imageUrl: model?.bgImageUrl ?? '', width: double.infinity), - Padding( - padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 12.5, bottom: 14), - child: Column( + child: Container( + width: double.infinity, + padding: const EdgeInsets.only(left: 12, right: 12, bottom: 14), + decoration: BoxDecoration( + color: HexColor.fromHex(model?.cardBgColor), + border: Border.all(color: HexColor.fromHex(model?.cardBorderColor), width: 1), + borderRadius: BorderRadius.all(Radius.circular(8)) + ), + child: Column( + children: [ + // 标题 + Row( + mainAxisAlignment: MainAxisAlignment.spaceBetween, + crossAxisAlignment: CrossAxisAlignment.center, children: [ - // 标题 - CachedNetworkImage(imageUrl: model?.titleImageUrl, width: 90,), - SizedBox(height: 20), - // 文案 - Text(model?.text?? '', style: TextStyle(color: HexColor.fromHex(model?.textColor), fontSize: 15), maxLines: 4, overflow: TextOverflow.ellipsis,), - SizedBox(height: 22), - // 复制按钮 or 分享 按钮 - Visibility( - visible: (model?.isShowShareFriend ?? '0') == '1', - // 仅仅复制按钮 - replacement: GestureDetector( onTap: () => _clickCopyButton(model?.text) ,child: CachedNetworkImage(imageUrl: model?.copyLongImageUrl ?? '', width: double.infinity)), - child: Row( - children: [ - // 复制按钮 - Flexible(flex: 1, child: GestureDetector(onTap: () => _clickCopyButton(model?.text),child: CachedNetworkImage(imageUrl: model?.copyImageUrl, width: double.infinity,))), - SizedBox(width: 20), - // 分享按钮 - Flexible(flex: 1,child: GestureDetector(onTap: ()=> _clickShareButton(model?.text), child: CachedNetworkImage(imageUrl: model?.shareImageUrl, width: double.infinity,))) - ], - )) + CachedNetworkImage(imageUrl: model?.scaleImageUrl, width: 36), + CachedNetworkImage(imageUrl: model?.titleImageUrl, width: 90), + SizedBox(width: 36,) ], ), - ), - ], + SizedBox(height: 20), + // 文案 + Text(model?.text?? '', style: TextStyle(color: HexColor.fromHex(model?.textColor), fontSize: 15), maxLines: 4, overflow: TextOverflow.ellipsis,), + SizedBox(height: 22), + // 复制按钮 or 分享 按钮 + Visibility( + visible: (model?.isShowShareFriend ?? '0') == '1', + // 仅仅复制按钮 + replacement: GestureDetector( onTap: () => _clickCopyButton(model?.text) ,child: CachedNetworkImage(imageUrl: model?.copyLongImageUrl ?? '', width: double.infinity)), + child: Row( + children: [ + // 复制按钮 + Flexible(flex: 1, child: GestureDetector(onTap: () => _clickCopyButton(model?.text),child: CachedNetworkImage(imageUrl: model?.copyImageUrl, width: double.infinity,))), + SizedBox(width: 20), + // 分享按钮 + Flexible(flex: 1,child: GestureDetector(onTap: ()=> _clickShareButton(model?.text), child: CachedNetworkImage(imageUrl: model?.shareImageUrl, width: double.infinity,))) + ], + )) + ], + ), ) ); }