diff --git a/lib/pages/message_notice_page/message_notice_page.dart b/lib/pages/message_notice_page/message_notice_page.dart index 62c7ad5..7a1d242 100644 --- a/lib/pages/message_notice_page/message_notice_page.dart +++ b/lib/pages/message_notice_page/message_notice_page.dart @@ -276,7 +276,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 官方通知样式 Widget _buildOfficialNoticeStyleWidget(OfficialNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { return GestureDetector( - onTap: ()=> _onItemClick(styleModel), + onTap: ()=> _onItemClick(dataModel), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), @@ -333,7 +333,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 官方活动样式 Widget _buildOfficialActivitiesStyleWidget(OfficialActivityStyle styleModel, MessageNoticeDataItemModel dataModel) { return GestureDetector( - onTap: ()=> _onItemClick(styleModel), + onTap: ()=> _onItemClick(dataModel), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), @@ -380,7 +380,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 交易通知样式 Widget _buildTradeNoticeStyleWidget(TransactionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { return GestureDetector( - onTap: ()=> _onItemClick(styleModel), + onTap: ()=> _onItemClick(dataModel), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), @@ -426,7 +426,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 推广通知样式 Widget _buildPromoteNoticeStyleWidget(PromotionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { return GestureDetector( - onTap: ()=> _onItemClick(styleModel), + onTap: ()=> _onItemClick(dataModel), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), @@ -441,7 +441,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ - _buildCustomerAvatarWidget(icon: styleModel?.icon), + _buildCustomerAvatarWidget(icon: dataModel?.img), const SizedBox(width: 10), Expanded( child: Column( @@ -480,7 +480,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine /// 反馈通知样式 Widget _buildFeedbackNoticeStyleWidget(FeedbackNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { return GestureDetector( - onTap: ()=> _onItemClick(styleModel), + onTap: ()=> _onItemClick(dataModel), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 15, right: 15, top: 14, bottom: 10), diff --git a/lib/pages/message_notice_page/model/message_notice_data_model.dart b/lib/pages/message_notice_page/model/message_notice_data_model.dart index b0c6426..4c65d4a 100644 --- a/lib/pages/message_notice_page/model/message_notice_data_model.dart +++ b/lib/pages/message_notice_page/model/message_notice_data_model.dart @@ -1,5 +1,7 @@ import 'dart:convert'; +import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/no_goods_dialog_style_model.dart'; +import 'package:zhiying_comm/models/base/skip_model.dart'; import 'package:zhiying_comm/util/empty_util.dart'; class MessageNoticeDataModel { @@ -22,7 +24,7 @@ class MessageNoticeDataModel { } } -class MessageNoticeDataItemModel { +class MessageNoticeDataItemModel extends SkipModel { String unread_count; String receiver; String body; @@ -55,28 +57,28 @@ class MessageNoticeDataItemModel { this.transactions, }); - factory MessageNoticeDataItemModel.fromJson(Map json) { - return MessageNoticeDataItemModel( - unread_count: json['unread_count']?.toString(), - receiver: json['receiver']?.toString(), - body: json['body']?.toString(), - date_time: json['date_time']?.toString(), - id: json['id']?.toString(), - img: json['img']?.toString(), - main_preview: json['main_preview']?.toString(), - oid: json['oid']?.toString(), - sender: json['sender']?.toString(), - status: json['status']?.toString(), - subtitle: json['subtitle']?.toString(), - title: json['title']?.toString(), - type: json['type']?.toString(), - transactions: - (!EmptyUtil.isEmpty(json['body']) && jsonDecode(json['body']) != null) ? (jsonDecode(json['body']) as List).map((e) => TransactionBodyItemModel.fromJson(e)).toList() : null, - ); + MessageNoticeDataItemModel.fromJson(Map json) { + super.fromJson(json); + unread_count = json['unread_count']?.toString(); + receiver = json['receiver']?.toString(); + body = json['body']?.toString(); + date_time = json['date_time']?.toString(); + id = json['id']?.toString(); + img = json['img']?.toString(); + main_preview = json['main_preview']?.toString(); + oid = json['oid']?.toString(); + sender = json['sender']?.toString(); + status = json['status']?.toString(); + subtitle = json['subtitle']?.toString(); + title = json['title']?.toString(); + type = json['type']?.toString(); + transactions = (!EmptyUtil.isEmpty(json['body']) && jsonDecode(json['body']) != null) + ? (jsonDecode(json['body']) as List).map((e) => TransactionBodyItemModel.fromJson(e)).toList() + : null; } Map toJson() { - final Map data = new Map(); + final Map data = super.toJson(); data['receiver'] = this.receiver; data['body'] = this.body; data['date_time'] = this.date_time; diff --git a/lib/pages/message_notice_page/model/message_notice_style_model.dart b/lib/pages/message_notice_page/model/message_notice_style_model.dart index 60b2d43..33280de 100644 --- a/lib/pages/message_notice_page/model/message_notice_style_model.dart +++ b/lib/pages/message_notice_page/model/message_notice_style_model.dart @@ -1,3 +1,5 @@ +import 'dart:collection'; + import 'package:zhiying_base_widget/dialog/global_dialog/intellect_search_goods_dialog/model/no_goods_dialog_style_model.dart'; import 'package:zhiying_comm/models/base/skip_model.dart'; @@ -81,7 +83,7 @@ class MessageNoticeStyleModel { } } -class FeedbackNotificationStyle extends SkipModel { +class FeedbackNotificationStyle { String bg_color; String icon; String message_value_color; @@ -110,7 +112,7 @@ class FeedbackNotificationStyle extends SkipModel { // } FeedbackNotificationStyle.fromJson(Map json) { - super.fromJson(json); + bg_color = json['bg_color']; icon = json['icon']; message_value_color = json['message_value_color']; @@ -120,7 +122,7 @@ class FeedbackNotificationStyle extends SkipModel { } Map toJson() { - final Map data = super.toJson(); + final Map data = new HashMap(); data['bg_color'] = this.bg_color; data['icon'] = this.icon; data['message_value_color'] = this.message_value_color; @@ -157,7 +159,7 @@ class MainNotificationStyle { } } -class MainNotificationStyleItem extends SkipModel { +class MainNotificationStyleItem { String bg_color; String icon; String name; @@ -201,7 +203,7 @@ class MainNotificationStyleItem extends SkipModel { } } -class OfficialActivityStyle extends SkipModel { +class OfficialActivityStyle { String bg_color; String message_value_color; String skip_identifier; @@ -217,7 +219,6 @@ class OfficialActivityStyle extends SkipModel { }); OfficialActivityStyle.fromJson(Map json) { - super.fromJson(json); bg_color = json['bg_color']; message_value_color = json['message_value_color']; skip_identifier = json['skip_identifier']; @@ -226,7 +227,7 @@ class OfficialActivityStyle extends SkipModel { } Map toJson() { - final Map data = super.toJson(); + final Map data = new HashMap(); data['bg_color'] = this.bg_color; data['message_value_color'] = this.message_value_color; data['skip_identifier'] = this.skip_identifier; @@ -236,7 +237,7 @@ class OfficialActivityStyle extends SkipModel { } } -class OfficialNotificationStyle extends SkipModel { +class OfficialNotificationStyle { String bg_color; String icon; String message_value_color; @@ -254,7 +255,6 @@ class OfficialNotificationStyle extends SkipModel { }); OfficialNotificationStyle.fromJson(Map json) { - super.fromJson(json); bg_color = json['bg_color']; icon = json['icon']; message_value_color = json['message_value_color']; @@ -264,7 +264,7 @@ class OfficialNotificationStyle extends SkipModel { } Map toJson() { - final Map data = super.toJson(); + final Map data = new HashMap(); data['bg_color'] = this.bg_color; data['icon'] = this.icon; data['message_value_color'] = this.message_value_color; @@ -275,7 +275,7 @@ class OfficialNotificationStyle extends SkipModel { } } -class PromotionNotificationStyle extends SkipModel { +class PromotionNotificationStyle { String bg_color; String icon; String message_value_color; @@ -303,7 +303,6 @@ class PromotionNotificationStyle extends SkipModel { // ); // } PromotionNotificationStyle.fromJson(Map json) { - super.fromJson(json); bg_color = json['bg_color']; icon = json['icon']; message_value_color = json['message_value_color']; @@ -313,7 +312,7 @@ class PromotionNotificationStyle extends SkipModel { } Map toJson() { - final Map data = super.toJson(); + final Map data = new HashMap(); data['bg_color'] = this.bg_color; data['icon'] = this.icon; data['message_value_color'] = this.message_value_color; @@ -324,7 +323,7 @@ class PromotionNotificationStyle extends SkipModel { } } -class TransactionNotificationStyle extends SkipModel { +class TransactionNotificationStyle { String bg_color; String earnings; String icon; @@ -356,7 +355,6 @@ class TransactionNotificationStyle extends SkipModel { // } TransactionNotificationStyle.fromJson(Map json) { - super.fromJson(json); bg_color = json['bg_color']; earnings = json['earnings']; icon = json['icon']; @@ -367,7 +365,7 @@ class TransactionNotificationStyle extends SkipModel { } Map toJson() { - final Map data = super.toJson(); + final Map data = new HashMap(); data['bg_color'] = this.bg_color; data['earnings'] = this.earnings; data['icon'] = this.icon; diff --git a/lib/widgets/team/fans_list/team_fans_item.dart b/lib/widgets/team/fans_list/team_fans_item.dart index 22de1d8..5dc0789 100644 --- a/lib/widgets/team/fans_list/team_fans_item.dart +++ b/lib/widgets/team/fans_list/team_fans_item.dart @@ -1,5 +1,6 @@ import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:zhiying_base_widget/pages/team_page/model/team_style_model.dart'; import 'package:cached_network_image/cached_network_image.dart'; import 'package:zhiying_base_widget/widgets/team/fans_list/model/team_fans_list_model.dart'; @@ -28,8 +29,13 @@ class _TeamFansItemState extends State { } /// 复制文字 - void _copyText() { - Fluttertoast.showToast(msg: '复制成功~'); + void _copyText(text) { + if(!EmptyUtil.isEmpty(text)) { + Clipboard.setData(ClipboardData(text: text)); + Fluttertoast.showToast(msg: '复制成功~'); + }else{ + Fluttertoast.showToast(msg: '内容不能为空'); + } } @override @@ -146,7 +152,7 @@ class _TeamFansItemState extends State { alignment: ui.PlaceholderAlignment.middle, child: GestureDetector( behavior: HitTestBehavior.opaque, - onTap: () => _copyText(), + onTap: () => _copyText(widget?.dataModel?.phone), child: Container( width: 11, margin: const EdgeInsets.only(left: 3), @@ -198,7 +204,7 @@ class _TeamFansItemState extends State { WidgetSpan( alignment: ui.PlaceholderAlignment.middle, child: GestureDetector( - onTap: () => _copyText(), + onTap: () => _copyText(widget?.dataModel?.wechat), behavior: HitTestBehavior.opaque, child: Container( padding: const EdgeInsets.only(left: 5.5), diff --git a/lib/widgets/team/recommend/team_recommend_widget.dart b/lib/widgets/team/recommend/team_recommend_widget.dart index 786b62a..1fe2dac 100644 --- a/lib/widgets/team/recommend/team_recommend_widget.dart +++ b/lib/widgets/team/recommend/team_recommend_widget.dart @@ -1,4 +1,5 @@ import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; import 'package:zhiying_base_widget/pages/team_page/model/team_data_model.dart'; import 'package:zhiying_base_widget/pages/team_page/model/team_style_model.dart'; import 'package:zhiying_base_widget/widgets/team/recommend/bloc/team_recommend_bloc.dart'; @@ -54,8 +55,13 @@ class __TeamRecommendWidgetState extends State<_TeamRecommendWidgetContainer> { } /// 拷贝 - void _copyText() { - Fluttertoast.showToast(msg: '复制成功~'); + void _copyText(String text) { + if(!EmptyUtil.isEmpty(text)) { + Clipboard.setData(ClipboardData(text: text)); + Fluttertoast.showToast(msg: '复制成功~'); + }else{ + Fluttertoast.showToast(msg: '内容不能为空~'); + } } @override @@ -321,7 +327,7 @@ class __TeamRecommendWidgetState extends State<_TeamRecommendWidgetContainer> { const SizedBox(width: 6), /// 拷贝按钮 - _getCustomCopyWidget(), + _getCustomCopyWidget(dataModel?.referrer_phone), ], ); } @@ -336,16 +342,16 @@ class __TeamRecommendWidgetState extends State<_TeamRecommendWidgetContainer> { const SizedBox(width: 6), /// 拷贝按钮 - _getCustomCopyWidget(), + _getCustomCopyWidget(dataModel?.referrer_wechat), ], ); } /// 自定义复制按钮的Widget - Widget _getCustomCopyWidget() { + Widget _getCustomCopyWidget(String text) { return GestureDetector( behavior: HitTestBehavior.opaque, - onTap: () => _copyText(), + onTap: () => _copyText(text), child: Container( padding: const EdgeInsets.only(left: 4, bottom: 2, top: 2, right: 6), decoration: BoxDecoration( diff --git a/lib/widgets/team_details/referrer/team_details_referrer_widget.dart b/lib/widgets/team_details/referrer/team_details_referrer_widget.dart index 3c7ad0f..0bc9a40 100644 --- a/lib/widgets/team_details/referrer/team_details_referrer_widget.dart +++ b/lib/widgets/team_details/referrer/team_details_referrer_widget.dart @@ -12,8 +12,12 @@ class TeamDetailsReferrerWidget extends StatelessWidget { TeamDetailsReferrerWidget(this.styleModel, this.dataModel); /// 复制文字 - void _copyText() { - Fluttertoast.showToast(msg: '复制成功~'); + void _copyText(String text) { + if (!EmptyUtil.isEmpty(text)) { + Fluttertoast.showToast(msg: '复制成功~'); + } else { + Fluttertoast.showToast(msg: '内容不能为空'); + } } @override @@ -138,7 +142,7 @@ class TeamDetailsReferrerWidget extends StatelessWidget { style: TextStyle(color: HexColor.fromHex(styleModel?.phone_color ?? '#333333'), fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), /// 复制按钮 - _getCopyWidget(), + _getCopyWidget(dataModel?.phone), // _getCopyWidget(), ]), ), @@ -149,12 +153,12 @@ class TeamDetailsReferrerWidget extends StatelessWidget { } /// 复制按钮 - InlineSpan _getCopyWidget() { + InlineSpan _getCopyWidget(String text) { return WidgetSpan( alignment: ui.PlaceholderAlignment.middle, child: GestureDetector( behavior: HitTestBehavior.opaque, - onTap: () => _copyText(), + onTap: () => _copyText(text), child: Container( width: 15, padding: const EdgeInsets.only(left: 3), @@ -190,7 +194,7 @@ class TeamDetailsReferrerWidget extends StatelessWidget { fontSize: 11, fontFamily: 'Din', package: 'zhiying_base_widget')), - _getCopyWidget(), + _getCopyWidget(dataModel?.wechat), ]), ),