浏览代码

1、分享内容组件的更新

tags/0.0.12+5^0
PH2 3 年前
父节点
当前提交
ecc361779d
共有 2 个文件被更改,包括 86 次插入60 次删除
  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 查看文件

@@ -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<String, dynamic> 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<String, dynamic> 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;
}
}
}

+ 37
- 28
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,)))
],
))
],
),
)
);
}


正在加载...
取消
保存