|
|
@@ -1,3 +1,5 @@ |
|
|
|
import 'dart:convert'; |
|
|
|
|
|
|
|
import 'package:flutter/cupertino.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_bloc/flutter_bloc.dart'; |
|
|
@@ -52,16 +54,15 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
|
|
|
|
/// 子item点击事件 |
|
|
|
void _onMainItemClick(MainNotificationStyleItem styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
|
|
|
|
/// 消除消息红点 |
|
|
|
BlocProvider.of<MessageNoticeBloc>(context).add(MessageNoticeClearPointEvent(selectId: dataModel?.id)); |
|
|
|
BlocProvider.of<MessageNoticeBloc>(context).add(MessageNoticeClearPointEvent(selectId: dataModel?.id.toString())); |
|
|
|
|
|
|
|
/// 如果是消息中心,则重新打开页面加载 |
|
|
|
Navigator.push(context, CupertinoPageRoute(builder: (_) => MessageNoticePage({'NoticePageType': styleModel?.type, 'NoticePageTitle': styleModel?.name}))); |
|
|
|
} |
|
|
|
|
|
|
|
/// 子item点击的公共跳转 |
|
|
|
void _onItemClick(SkipModel model){ |
|
|
|
void _onItemClick(SkipModel model) { |
|
|
|
RouterUtil.route(model, model.toJson(), context); |
|
|
|
} |
|
|
|
|
|
|
@@ -162,7 +163,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
|
|
|
|
/// 交易通知 |
|
|
|
if (styleType == 'transaction_notification') { |
|
|
|
return _buildTradeNoticeStyleWidget(styleModel?.transaction_notification, itemDataModel); |
|
|
|
return _buildOfficialNoticeStyleWidget2(styleModel?.transaction_notification, itemDataModel); |
|
|
|
} |
|
|
|
|
|
|
|
/// 推广通知 |
|
|
@@ -236,7 +237,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
width: double.infinity, |
|
|
|
child: Row( |
|
|
|
children: <Widget>[ |
|
|
|
_buildCustomerAvatarWidget(icon: styleModel?.icon, unreadBgColor: unreadBgColor, unreadTextColor: unreadTextColor, value: dataModel?.unread_count), |
|
|
|
_buildCustomerAvatarWidget(icon: styleModel?.icon, unreadBgColor: unreadBgColor, unreadTextColor: unreadTextColor, value: dataModel?.unreadCount), |
|
|
|
const SizedBox(width: 10), |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
@@ -251,14 +252,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
styleModel?.name ?? '官方活动', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.name_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 13), |
|
|
|
), |
|
|
|
Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 12)), |
|
|
|
Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 12)), |
|
|
|
], |
|
|
|
), |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(right: 22), |
|
|
|
child: Text( |
|
|
|
//'2020年6月23日4:00至6月30日4:00关闭提现aaa', |
|
|
|
dataModel?.main_preview ?? '', |
|
|
|
dataModel?.messageContent.title ?? '', |
|
|
|
maxLines: 1, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.value_color ?? '#999999'), fontSize: 12), |
|
|
@@ -280,7 +281,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
/// 官方通知样式 |
|
|
|
Widget _buildOfficialNoticeStyleWidget(OfficialNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: ()=> _onItemClick(dataModel), |
|
|
|
onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), |
|
|
@@ -303,14 +304,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
children: <Widget>[ |
|
|
|
/// 标题 |
|
|
|
Text( |
|
|
|
dataModel?.title ?? '', |
|
|
|
dataModel?.messageContent.title ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), |
|
|
|
), |
|
|
|
const SizedBox(height: 5), |
|
|
|
|
|
|
|
/// 内容 |
|
|
|
Text( |
|
|
|
dataModel?.subtitle ?? '', |
|
|
|
dataModel?.messageContent.title ?? '', |
|
|
|
maxLines: 3, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11), |
|
|
@@ -325,7 +326,64 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 16), |
|
|
|
child: Text( |
|
|
|
dataModel?.date_time ?? '', |
|
|
|
dataModel?.dateTime ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11), |
|
|
|
)) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// 交易通知样式 |
|
|
|
Widget _buildOfficialNoticeStyleWidget2(TransactionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), |
|
|
|
margin: const EdgeInsets.only(bottom: 7.5), |
|
|
|
decoration: BoxDecoration( |
|
|
|
color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'), |
|
|
|
borderRadius: BorderRadius.circular(7.5), |
|
|
|
), |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
_buildCustomerAvatarWidget(icon: styleModel?.icon), |
|
|
|
const SizedBox(width: 10), |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
/// 标题 |
|
|
|
Text( |
|
|
|
dataModel?.messageContent.title ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), |
|
|
|
), |
|
|
|
const SizedBox(height: 5), |
|
|
|
|
|
|
|
/// 内容 |
|
|
|
Text( |
|
|
|
dataModel?.messageContent.title ?? '', |
|
|
|
maxLines: 3, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
|
|
|
|
/// 时间 |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 16), |
|
|
|
child: Text( |
|
|
|
dataModel?.dateTime ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11), |
|
|
|
)) |
|
|
|
], |
|
|
@@ -337,7 +395,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
/// 官方活动样式 |
|
|
|
Widget _buildOfficialActivitiesStyleWidget(OfficialActivityStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: ()=> _onItemClick(dataModel), |
|
|
|
onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), |
|
|
@@ -348,7 +406,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
children: <Widget>[ |
|
|
|
/// 标题 |
|
|
|
Text( |
|
|
|
dataModel?.title ?? '', |
|
|
|
dataModel?.messageContent.title ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 14), |
|
|
|
maxLines: 1, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
@@ -359,14 +417,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
ClipRRect( |
|
|
|
borderRadius: BorderRadius.circular(7.5), |
|
|
|
child: CachedNetworkImage( |
|
|
|
imageUrl: dataModel?.img ?? '', |
|
|
|
imageUrl: dataModel?.messageContent?.image ?? '', |
|
|
|
width: double.infinity, |
|
|
|
)), |
|
|
|
const SizedBox(height: 6.5), |
|
|
|
|
|
|
|
/// 活动内容 |
|
|
|
Text( |
|
|
|
dataModel?.subtitle ?? '', |
|
|
|
dataModel?.messageContent?.content ?? '', |
|
|
|
maxLines: 2, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(fontSize: 11, color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999')), |
|
|
@@ -374,7 +432,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
|
|
|
|
/// 时间 |
|
|
|
const SizedBox(height: 7), |
|
|
|
Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11)) |
|
|
|
Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11)) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
@@ -384,7 +442,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
/// 交易通知样式 |
|
|
|
Widget _buildTradeNoticeStyleWidget(TransactionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: ()=> _onItemClick(dataModel), |
|
|
|
onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), |
|
|
@@ -406,11 +464,12 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
/// 标题 |
|
|
|
Text(dataModel?.title ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), |
|
|
|
Text(dataModel?.messageContent.title ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), |
|
|
|
const SizedBox(height: 5), |
|
|
|
|
|
|
|
/// 内容 |
|
|
|
_buildCustomerTradeContentWidget(styleModel, dataModel?.transactions), |
|
|
|
// _buildCustomerTradeContentWidget(styleModel, dataModel?.transactions), |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
@@ -420,7 +479,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
/// 时间 |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 16), |
|
|
|
child: Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
child: Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
@@ -430,7 +489,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
/// 推广通知样式 |
|
|
|
Widget _buildPromoteNoticeStyleWidget(PromotionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: ()=> _onItemClick(dataModel), |
|
|
|
onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), |
|
|
@@ -445,7 +504,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
Row( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
_buildCustomerAvatarWidget(icon: dataModel?.img), |
|
|
|
_buildCustomerAvatarWidget(icon: styleModel?.icon), |
|
|
|
const SizedBox(width: 10), |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
@@ -453,14 +512,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
children: <Widget>[ |
|
|
|
/// 标题 |
|
|
|
Text( |
|
|
|
dataModel?.title ?? '', |
|
|
|
dataModel?.messageContent.title ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), |
|
|
|
), |
|
|
|
const SizedBox(height: 5), |
|
|
|
|
|
|
|
/// 内容 |
|
|
|
Text( |
|
|
|
dataModel?.subtitle ?? '恭喜您成功邀请152****5887加入您的团队,快带领小伙伴走向致富之路吧!', |
|
|
|
dataModel?.messageContent?.content ?? '恭喜您成功邀请152****5887加入您的团队,快带领小伙伴走向致富之路吧!', |
|
|
|
maxLines: 3, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11), |
|
|
@@ -474,7 +533,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
/// 时间 |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 16), |
|
|
|
child: Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
child: Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
@@ -484,7 +543,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
/// 反馈通知样式 |
|
|
|
Widget _buildFeedbackNoticeStyleWidget(FeedbackNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: ()=> _onItemClick(dataModel), |
|
|
|
onTap: () => _onItemClick(SkipModel.fromJson(json.decode(dataModel.skipIdentifier))), |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 14, bottom: 10), |
|
|
@@ -506,11 +565,12 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
/// 标题 |
|
|
|
Text(dataModel?.title ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), |
|
|
|
Text(dataModel?.messageContent.title ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), |
|
|
|
const SizedBox(height: 3), |
|
|
|
|
|
|
|
/// 内容 |
|
|
|
Text(dataModel?.subtitle ?? '', |
|
|
|
Text( dataModel?.messageContent?.content ?? '', |
|
|
|
maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11)) |
|
|
|
], |
|
|
|
), |
|
|
@@ -521,7 +581,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
/// 时间 |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 16), |
|
|
|
child: Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
child: Text(dataModel?.dateTime ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
@@ -581,7 +641,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
borderRadius: BorderRadius.circular(6), |
|
|
|
border: Border.all(color: HexColor.fromHex('#FFFFFF'), width: 0.5)), |
|
|
|
child: Text( |
|
|
|
value?? '', |
|
|
|
value ?? '', |
|
|
|
textAlign: TextAlign.center, |
|
|
|
style: TextStyle(fontSize: 9, color: HexColor.fromHex(unreadTextColor ?? '#FFFFFF')), |
|
|
|
), |
|
|
@@ -593,28 +653,28 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// 转账自定义widget |
|
|
|
Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel, List<TransactionBodyItemModel> transactions) { |
|
|
|
List<Widget> lists = []; |
|
|
|
transactions.forEach((element) { |
|
|
|
bool isearnings = (element?.type ?? '') == 'earnings'; |
|
|
|
lists.add(Padding( |
|
|
|
padding: const EdgeInsets.only(bottom: 5), |
|
|
|
child: RichText( |
|
|
|
textAlign: TextAlign.start, |
|
|
|
text: TextSpan(children: [ |
|
|
|
TextSpan(text: element?.text ?? '', style: TextStyle(fontSize: 11, color: HexColor.fromHex( styleModel?.message_value_color ?? '#999999'))), |
|
|
|
TextSpan(text: element?.data ?? '', style: TextStyle(fontSize: 11, color: HexColor.fromHex( isearnings ? |
|
|
|
styleModel?.earnings ?? '#FF0100' |
|
|
|
: styleModel?.message_value_color ?? '#999999'))), |
|
|
|
]), |
|
|
|
), |
|
|
|
)); |
|
|
|
}); |
|
|
|
|
|
|
|
return Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: lists, |
|
|
|
); |
|
|
|
} |
|
|
|
// /// 转账自定义widget |
|
|
|
// Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel, List<TransactionBodyItemModel> transactions) { |
|
|
|
// List<Widget> lists = []; |
|
|
|
// transactions.forEach((element) { |
|
|
|
// bool isearnings = (element?.type ?? '') == 'earnings'; |
|
|
|
// lists.add(Padding( |
|
|
|
// padding: const EdgeInsets.only(bottom: 5), |
|
|
|
// child: RichText( |
|
|
|
// textAlign: TextAlign.start, |
|
|
|
// text: TextSpan(children: [ |
|
|
|
// TextSpan(text: element?.text ?? '', style: TextStyle(fontSize: 11, color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'))), |
|
|
|
// TextSpan( |
|
|
|
// text: element?.data ?? '', |
|
|
|
// style: TextStyle(fontSize: 11, color: HexColor.fromHex(isearnings ? styleModel?.earnings ?? '#FF0100' : styleModel?.message_value_color ?? '#999999'))), |
|
|
|
// ]), |
|
|
|
// ), |
|
|
|
// )); |
|
|
|
// }); |
|
|
|
// |
|
|
|
// return Column( |
|
|
|
// crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
// children: lists, |
|
|
|
// ); |
|
|
|
// } |
|
|
|
} |