Browse Source

1、分享内容组件的更新

tags/0.0.12+5^0
PH2 4 years ago
parent
commit
ecc361779d
2 changed files with 86 additions and 60 deletions
  1. +49
    -32
      lib/widgets/custom/share_content/model/custom_share_content_model.dart
  2. +37
    -28
      lib/widgets/custom/share_content/share_content_widget.dart

+ 49
- 32
lib/widgets/custom/share_content/model/custom_share_content_model.dart View File

@@ -1,6 +1,6 @@
import 'package:zhiying_comm/zhiying_comm.dart'; import 'package:zhiying_comm/zhiying_comm.dart';


class CustomShareContentModel extends SkipModel{ class CustomShareContentModel extends SkipModel {
String name; String name;
String desc; String desc;
String text; String text;
@@ -30,37 +30,46 @@ class CustomShareContentModel extends SkipModel{
String textColor; String textColor;
String skipName; String skipName;
String cateTag; String cateTag;
String cardBgColor;
String cardBorderColor;
String scaleImage;
String scaleImageUrl;


CustomShareContentModel( CustomShareContentModel({
{this.name, this.name,
this.desc, this.desc,
this.text, this.text,
this.moduleType, this.moduleType,
this.moduleKey, this.moduleKey,
this.isTopMargin, this.isTopMargin,
this.isLeftRightMargin, this.isLeftRightMargin,
this.isShow, this.isShow,
this.topMargin, this.topMargin,
this.leftRightMargin, this.leftRightMargin,
this.topLeftRadius, this.topLeftRadius,
this.topRightRadius, this.topRightRadius,
this.bottomLeftRadius, this.bottomLeftRadius,
this.bottomRightRadius, this.bottomRightRadius,
this.bgColor, this.bgColor,
this.isShowShareFriend, this.isShowShareFriend,
this.bgImage, this.bgImage,
this.bgImageUrl, this.bgImageUrl,
this.titleImage, this.titleImage,
this.titleImageUrl, this.titleImageUrl,
this.copyImage, this.copyImage,
this.copyImageUrl, this.copyImageUrl,
this.copyLongImage, this.copyLongImage,
this.copyLongImageUrl, this.copyLongImageUrl,
this.shareImage, this.shareImage,
this.shareImageUrl, this.shareImageUrl,
this.textColor, this.textColor,
this.skipName, this.skipName,
this.cateTag}); this.cateTag,
this.cardBgColor,
this.cardBorderColor,
this.scaleImage,
this.scaleImageUrl,
});


CustomShareContentModel.fromJson(Map<String, dynamic> json) { CustomShareContentModel.fromJson(Map<String, dynamic> json) {
super.fromJson(json); super.fromJson(json);
@@ -97,6 +106,10 @@ class CustomShareContentModel extends SkipModel{
requiredTaobaoAuth = json['required_taobao_auth']; requiredTaobaoAuth = json['required_taobao_auth'];
isJump = json['is_jump']; isJump = json['is_jump'];
cateTag = json['cate_tag']; cateTag = json['cate_tag'];
cardBgColor = json['card_bg_color'];
cardBorderColor = json['card_border_color'];
scaleImage = json['scale_image'];
scaleImageUrl = json['scale_image_url'];
} }


Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@@ -134,6 +147,10 @@ class CustomShareContentModel extends SkipModel{
data['required_taobao_auth'] = this.requiredTaobaoAuth; data['required_taobao_auth'] = this.requiredTaobaoAuth;
data['is_jump'] = this.isJump; data['is_jump'] = this.isJump;
data['cate_tag'] = this.cateTag; 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; return data;
} }
} }

+ 37
- 28
lib/widgets/custom/share_content/share_content_widget.dart View File

@@ -91,37 +91,46 @@ class _CustomShareContentContainerWidgetState extends State<_CustomShareContentC
topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)), topLeft: Radius.circular(ParseUtil.stringParseDouble(model?.topLeftRadius)),
topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)), topRight: Radius.circular(ParseUtil.stringParseDouble(model?.topRightRadius)),
)), )),
child: Stack( child: Container(
children: [ width: double.infinity,
CachedNetworkImage(imageUrl: model?.bgImageUrl ?? '', width: double.infinity), padding: const EdgeInsets.only(left: 12, right: 12, bottom: 14),
Padding( decoration: BoxDecoration(
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 12.5, bottom: 14), color: HexColor.fromHex(model?.cardBgColor),
child: Column( 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: [ children: [
// 标题 CachedNetworkImage(imageUrl: model?.scaleImageUrl, width: 36),
CachedNetworkImage(imageUrl: model?.titleImageUrl, width: 90,), CachedNetworkImage(imageUrl: model?.titleImageUrl, width: 90),
SizedBox(height: 20), SizedBox(width: 36,)
// 文案
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,)))
],
))
], ],
), ),
), 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,)))
],
))
],
),
) )
); );
} }


||||||
x
 
000:0
Loading…
Cancel
Save