|
|
@@ -4,9 +4,11 @@ import 'package:flutter_bloc/flutter_bloc.dart'; |
|
|
|
import 'package:pull_to_refresh/pull_to_refresh.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/message_notice_page/bloc/message_notice_bloc.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/message_notice_page/bloc/message_notice_repository.dart'; |
|
|
|
import 'package:zhiying_base_widget/pages/message_notice_page/model/message_notice_data_model.dart'; |
|
|
|
import 'package:zhiying_base_widget/widgets/empty/empty_widget.dart'; |
|
|
|
import 'package:zhiying_comm/zhiying_comm.dart'; |
|
|
|
|
|
|
|
import 'message_notice_page_sk.dart'; |
|
|
|
import 'model/message_notice_style_model.dart'; |
|
|
|
|
|
|
|
/// |
|
|
@@ -20,13 +22,17 @@ class MessageNoticePage extends StatelessWidget { |
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return BlocProvider<MessageNoticeBloc>( |
|
|
|
create: (_) => MessageNoticeBloc(MessageNoticeRepository()), |
|
|
|
child: _MessageNoticePageContainer(), |
|
|
|
create: (_) => MessageNoticeBloc(MessageNoticeRepository(data)), |
|
|
|
child: _MessageNoticePageContainer( |
|
|
|
key: UniqueKey(), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
class _MessageNoticePageContainer extends StatefulWidget { |
|
|
|
_MessageNoticePageContainer({Key key}) : super(key: key); |
|
|
|
|
|
|
|
@override |
|
|
|
__MessageNoticePageContainerState createState() => __MessageNoticePageContainerState(); |
|
|
|
} |
|
|
@@ -35,10 +41,25 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
RefreshController _refreshController; |
|
|
|
|
|
|
|
/// 刷新 |
|
|
|
void _onRefresh() async {} |
|
|
|
void _onRefresh() async { |
|
|
|
BlocProvider.of<MessageNoticeBloc>(context).add(MessageNoticeOnRefreshEvent()); |
|
|
|
} |
|
|
|
|
|
|
|
/// 下拉更多 |
|
|
|
void _onLoad() async {} |
|
|
|
void _onLoad() async { |
|
|
|
BlocProvider.of<MessageNoticeBloc>(context).add(MessageNoticeOnLoadEvent()); |
|
|
|
} |
|
|
|
|
|
|
|
/// 子item点击事件 |
|
|
|
void _onMainItemClick(MainNotificationStyleItem styleModel) { |
|
|
|
/// 如果是消息中心,则重新打开页面加载 |
|
|
|
Navigator.push(context, CupertinoPageRoute(builder: (_) => MessageNoticePage({'type': styleModel?.type, 'title': styleModel?.name}))); |
|
|
|
} |
|
|
|
|
|
|
|
/// TODO 需要实现 子widget点击事件,公共跳转 |
|
|
|
void _onItemClick(){ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
void initState() { |
|
|
@@ -49,6 +70,12 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
super.initState(); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
void dispose() { |
|
|
|
_refreshController?.dispose(); |
|
|
|
super.dispose(); |
|
|
|
} |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
return BlocConsumer<MessageNoticeBloc, MessageNoticeState>( |
|
|
@@ -87,7 +114,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
builder: (context, state) { |
|
|
|
/// 数据加载成功 |
|
|
|
if (state is MessageNoticeLoadedState) { |
|
|
|
return _buildDataListWidget(state?.styleModel); |
|
|
|
return _buildDataListWidget(state?.styleModel, state?.dataModel); |
|
|
|
} |
|
|
|
|
|
|
|
/// 数据初始化失败 |
|
|
@@ -102,21 +129,52 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
} |
|
|
|
|
|
|
|
/// 有数据 |
|
|
|
Widget _buildDataListWidget(MessageNoticeStyleModel styleModel) { |
|
|
|
Widget _buildDataListWidget(MessageNoticeStyleModel styleModel, MessageNoticeDataModel dataModel) { |
|
|
|
return Scaffold( |
|
|
|
appBar: _buildAppBarWidget(), |
|
|
|
appBar: _buildAppBarWidget(styleModel), |
|
|
|
body: SmartRefresher( |
|
|
|
controller: _refreshController, |
|
|
|
onRefresh: _onRefresh, |
|
|
|
onLoading: _onLoad, |
|
|
|
enablePullDown: true, |
|
|
|
enablePullUp: true, |
|
|
|
enablePullUp: styleModel.isFist ? false : true, |
|
|
|
child: ListView.builder( |
|
|
|
padding: const EdgeInsets.only(left: 12.5, right: 12.5, top: 8), |
|
|
|
itemCount: styleModel?.main_notification?.list?.length ?? 0, |
|
|
|
itemCount: dataModel?.list?.length ?? 0, |
|
|
|
itemBuilder: (context, index) { |
|
|
|
/// 子视图的样式类型 |
|
|
|
String styleType = styleModel?.styleType ?? 'main'; |
|
|
|
MessageNoticeDataItemModel itemDataModel = !EmptyUtil.isEmpty(dataModel.list) ? dataModel.list[index] : null; |
|
|
|
|
|
|
|
/// 官方活动 |
|
|
|
if (styleType == 'official_activity') { |
|
|
|
return _buildOfficialActivitiesStyleWidget(styleModel?.official_activity, itemDataModel); |
|
|
|
} |
|
|
|
|
|
|
|
///官方通知 |
|
|
|
if (styleType == 'official_notification') { |
|
|
|
return _buildOfficialNoticeStyleWidget(styleModel?.official_notification, itemDataModel); |
|
|
|
} |
|
|
|
|
|
|
|
/// 交易通知 |
|
|
|
if (styleType == 'transaction_notification') { |
|
|
|
return _buildTradeNoticeStyleWidget(styleModel?.transaction_notification, itemDataModel); |
|
|
|
} |
|
|
|
|
|
|
|
/// 推广通知 |
|
|
|
if (styleType == 'promotion_notification') { |
|
|
|
return _buildPromoteNoticeStyleWidget(styleModel?.promotion_notification, itemDataModel); |
|
|
|
} |
|
|
|
|
|
|
|
/// 反馈通知 |
|
|
|
if (styleType == 'feedback_notification') { |
|
|
|
return _buildFeedbackNoticeStyleWidget(styleModel?.feedback_notification, itemDataModel); |
|
|
|
} |
|
|
|
|
|
|
|
/// 默认返回消息中心样式 |
|
|
|
return _buildMessageCenterStyleWidget( |
|
|
|
styleModel?.main_notification?.list[index], |
|
|
|
dataModel.list[index], |
|
|
|
index, |
|
|
|
styleModel?.main_notification?.list?.length, |
|
|
|
styleModel?.main_notification?.unread_text_color, |
|
|
@@ -130,13 +188,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
/// 没有数据 |
|
|
|
Widget _buildEmptyWidget() { |
|
|
|
return Scaffold( |
|
|
|
appBar: _buildAppBarWidget(), |
|
|
|
appBar: _buildAppBarWidget(null), |
|
|
|
body: SmartRefresher( |
|
|
|
controller: _refreshController, |
|
|
|
onRefresh: _onRefresh, |
|
|
|
enablePullDown: true, |
|
|
|
enablePullUp: false, |
|
|
|
child: ListView( |
|
|
|
padding: const EdgeInsets.only(top: 30), |
|
|
|
children: <Widget>[ |
|
|
|
EmptyWidget(), |
|
|
|
], |
|
|
@@ -148,298 +207,325 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
/// 骨架图 |
|
|
|
Widget _buildSkeletonWidget() { |
|
|
|
return Scaffold( |
|
|
|
appBar: _buildAppBarWidget(), |
|
|
|
body: Container(), |
|
|
|
appBar: _buildAppBarWidget(null), |
|
|
|
body: MessageNoticePageSkeleton(), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// 消息中心样式 |
|
|
|
Widget _buildMessageCenterStyleWidget(MainNotificationStyleItem styleModel, int index, int length, String unreadTextColor, String unreadBgColor) { |
|
|
|
Widget _buildMessageCenterStyleWidget( |
|
|
|
MainNotificationStyleItem styleModel, MessageNoticeDataItemModel dataModel, int index, int length, String unreadTextColor, String unreadBgColor) { |
|
|
|
var borderRadius = index == 0 |
|
|
|
? BorderRadius.only(topLeft: Radius.circular(7.5), topRight: Radius.circular(7.5)) |
|
|
|
: index == length - 1 ? BorderRadius.only(bottomRight: Radius.circular(7.5), bottomLeft: Radius.circular(7.5)) : BorderRadius.only(); |
|
|
|
|
|
|
|
return Container( |
|
|
|
decoration: BoxDecoration(color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'), borderRadius: borderRadius), |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 16), |
|
|
|
child: Column( |
|
|
|
children: <Widget>[ |
|
|
|
Container( |
|
|
|
height: 30, |
|
|
|
width: double.infinity, |
|
|
|
child: Row( |
|
|
|
return GestureDetector( |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
onTap: () => _onMainItemClick(styleModel), |
|
|
|
child: Container( |
|
|
|
decoration: BoxDecoration(color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF'), borderRadius: borderRadius), |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 16), |
|
|
|
child: Column( |
|
|
|
children: <Widget>[ |
|
|
|
Container( |
|
|
|
height: 30, |
|
|
|
width: double.infinity, |
|
|
|
child: Row( |
|
|
|
children: <Widget>[ |
|
|
|
_buildCustomerAvatarWidget(icon: styleModel?.icon, unreadBgColor: unreadBgColor, unreadTextColor: unreadTextColor, value: dataModel?.unread_count), |
|
|
|
const SizedBox(width: 10), |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
/// 官方活动 |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: <Widget>[ |
|
|
|
Text( |
|
|
|
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)), |
|
|
|
], |
|
|
|
), |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(right: 22), |
|
|
|
child: Text( |
|
|
|
//'2020年6月23日4:00至6月30日4:00关闭提现aaa', |
|
|
|
dataModel?.main_preview ?? '', |
|
|
|
maxLines: 1, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.value_color ?? '#999999'), fontSize: 12), |
|
|
|
), |
|
|
|
), |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
Padding(padding: const EdgeInsets.only(top: 14.5), child: Divider(height: 0.5, color: HexColor.fromHex('#EFEFEF'))) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// 官方通知样式 |
|
|
|
Widget _buildOfficialNoticeStyleWidget(OfficialNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: ()=> _onItemClick(), |
|
|
|
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, unreadBgColor: unreadBgColor, unreadTextColor: unreadTextColor), |
|
|
|
_buildCustomerAvatarWidget(icon: styleModel?.icon), |
|
|
|
const SizedBox(width: 10), |
|
|
|
Expanded( |
|
|
|
child: Column( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
/// 官方活动 |
|
|
|
Row( |
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween, |
|
|
|
children: <Widget>[ |
|
|
|
Text( |
|
|
|
styleModel?.name ?? '官方活动', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.name_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 13), |
|
|
|
), |
|
|
|
Text('04-20 16:00', 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', |
|
|
|
maxLines: 1, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.value_color ?? '#999999'), fontSize: 12), |
|
|
|
), |
|
|
|
/// 标题 |
|
|
|
Text( |
|
|
|
dataModel?.title ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), |
|
|
|
), |
|
|
|
const SizedBox(height: 5), |
|
|
|
|
|
|
|
/// 内容 |
|
|
|
Text( |
|
|
|
dataModel?.subtitle ?? '', |
|
|
|
maxLines: 3, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
Padding(padding: const EdgeInsets.only(top: 14.5), child: Divider(height: 0.5, color: HexColor.fromHex('#EFEFEF'))) |
|
|
|
], |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// 官方通知样式 |
|
|
|
Widget _buildOfficialNoticeStyleWidget(OfficialNotificationStyle styleModel) { |
|
|
|
return 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( |
|
|
|
'关于关闭提现功能通知', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), |
|
|
|
), |
|
|
|
const SizedBox(height: 5), |
|
|
|
|
|
|
|
/// 内容 |
|
|
|
Text( |
|
|
|
'由于微信官方的限制,我们暂时将嗨如意小程序内的提现功能进行关闭并进行维护,关闭功能时间为2020年6月23日4:00至6月30日4:00,请谅解', |
|
|
|
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( |
|
|
|
'2020-06-23 01:00:06', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11), |
|
|
|
)) |
|
|
|
], |
|
|
|
/// 时间 |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 16), |
|
|
|
child: Text( |
|
|
|
dataModel?.date_time ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11), |
|
|
|
)) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// 官方活动样式 |
|
|
|
Widget _buildOfficialActivitiesStyleWidget(OfficialActivityStyle styleModel) { |
|
|
|
return Container( |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 12.5, bottom: 10), |
|
|
|
margin: const EdgeInsets.only(bottom: 7.5), |
|
|
|
decoration: BoxDecoration(borderRadius: BorderRadius.circular(7.5), color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF')), |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
/// 标题 |
|
|
|
Text( |
|
|
|
'8.8淘宝会员节大促', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 14), |
|
|
|
maxLines: 1, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
const SizedBox(height: 6), |
|
|
|
|
|
|
|
/// 图片海报 |
|
|
|
ClipRRect( |
|
|
|
borderRadius: BorderRadius.circular(7.5), |
|
|
|
child: CachedNetworkImage( |
|
|
|
imageUrl: 'http://ossq.izhyin.cn/index_carousel_1.png', |
|
|
|
width: double.infinity, |
|
|
|
)), |
|
|
|
const SizedBox(height: 6.5), |
|
|
|
|
|
|
|
/// 活动内容 |
|
|
|
Text( |
|
|
|
'京东家电815周年庆,全场家电最低五折起,买一送一等超多优惠活动,点击查看活动详情', |
|
|
|
maxLines: 2, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(fontSize: 11, color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999')), |
|
|
|
), |
|
|
|
Widget _buildOfficialActivitiesStyleWidget(OfficialActivityStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: ()=> _onItemClick(), |
|
|
|
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(borderRadius: BorderRadius.circular(7.5), color: HexColor.fromHex(styleModel?.bg_color ?? '#FFFFFF')), |
|
|
|
child: Column( |
|
|
|
crossAxisAlignment: CrossAxisAlignment.start, |
|
|
|
children: <Widget>[ |
|
|
|
/// 标题 |
|
|
|
Text( |
|
|
|
dataModel?.title ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 14), |
|
|
|
maxLines: 1, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
), |
|
|
|
const SizedBox(height: 6), |
|
|
|
|
|
|
|
/// 图片海报 |
|
|
|
ClipRRect( |
|
|
|
borderRadius: BorderRadius.circular(7.5), |
|
|
|
child: CachedNetworkImage( |
|
|
|
imageUrl: dataModel?.img ?? '', |
|
|
|
width: double.infinity, |
|
|
|
)), |
|
|
|
const SizedBox(height: 6.5), |
|
|
|
|
|
|
|
/// 活动内容 |
|
|
|
Text( |
|
|
|
dataModel?.subtitle ?? '', |
|
|
|
maxLines: 2, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(fontSize: 11, color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999')), |
|
|
|
), |
|
|
|
|
|
|
|
/// 时间 |
|
|
|
const SizedBox(height: 7), |
|
|
|
Text('2020-06-23 01:00:06', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11)) |
|
|
|
], |
|
|
|
/// 时间 |
|
|
|
const SizedBox(height: 7), |
|
|
|
Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11)) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// 交易通知样式 |
|
|
|
Widget _buildTradeNoticeStyleWidget(TransactionNotificationStyle styleModel) { |
|
|
|
return 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('自购订单收益', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), |
|
|
|
const SizedBox(height: 5), |
|
|
|
|
|
|
|
/// 内容 |
|
|
|
_buildCustomerTradeContentWidget(styleModel), |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
Widget _buildTradeNoticeStyleWidget(TransactionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: ()=> _onItemClick(), |
|
|
|
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?.title ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), |
|
|
|
const SizedBox(height: 5), |
|
|
|
|
|
|
|
/// 时间 |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 16), |
|
|
|
child: Text('2020-06-23 01:00:06', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
], |
|
|
|
/// 内容 |
|
|
|
_buildCustomerTradeContentWidget(styleModel, dataModel?.transactions), |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
|
|
|
|
/// 时间 |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 16), |
|
|
|
child: Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// 推广通知样式 |
|
|
|
Widget _buildPromoteNoticeStyleWidget(PromotionNotificationStyle styleModel) { |
|
|
|
return 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( |
|
|
|
'新增直推粉丝', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), |
|
|
|
), |
|
|
|
const SizedBox(height: 5), |
|
|
|
|
|
|
|
/// 内容 |
|
|
|
Text( |
|
|
|
'恭喜您成功邀请152****5887加入您的团队,快带领小伙伴走向致富之路吧!', |
|
|
|
maxLines: 3, |
|
|
|
overflow: TextOverflow.ellipsis, |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
Widget _buildPromoteNoticeStyleWidget(PromotionNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: ()=> _onItemClick(), |
|
|
|
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?.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加入您的团队,快带领小伙伴走向致富之路吧!', |
|
|
|
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('2020-06-23 01:00:06', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
], |
|
|
|
/// 时间 |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 16), |
|
|
|
child: Text(dataModel?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// 反馈通知样式 |
|
|
|
Widget _buildFeedbackNoticeStyleWidget(FeedbackNotificationStyle styleModel) { |
|
|
|
return Container( |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 14, 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('您的反馈有回复啦', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), |
|
|
|
const SizedBox(height: 3), |
|
|
|
|
|
|
|
/// 内容 |
|
|
|
Text('点击查看回复详情', |
|
|
|
maxLines: 1, overflow: TextOverflow.ellipsis, style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11)) |
|
|
|
], |
|
|
|
), |
|
|
|
) |
|
|
|
], |
|
|
|
), |
|
|
|
Widget _buildFeedbackNoticeStyleWidget(FeedbackNotificationStyle styleModel, MessageNoticeDataItemModel dataModel) { |
|
|
|
return GestureDetector( |
|
|
|
onTap: ()=> _onItemClick(), |
|
|
|
behavior: HitTestBehavior.opaque, |
|
|
|
child: Container( |
|
|
|
padding: const EdgeInsets.only(left: 15, right: 15, top: 14, 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?.title ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), |
|
|
|
const SizedBox(height: 3), |
|
|
|
|
|
|
|
/// 时间 |
|
|
|
Padding( |
|
|
|
padding: const EdgeInsets.only(top: 16), |
|
|
|
child: Text(styleModel?.time_color ?? '2020-06-23 01:00:06', style: TextStyle(color: HexColor.fromHex('#D8D8D8'), fontSize: 11))) |
|
|
|
], |
|
|
|
/// 内容 |
|
|
|
Text(dataModel?.subtitle ?? '', |
|
|
|
maxLines: 1, 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?.date_time ?? '', style: TextStyle(color: HexColor.fromHex(styleModel?.time_color ?? '#D8D8D8'), fontSize: 11))) |
|
|
|
], |
|
|
|
), |
|
|
|
), |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
/// APPBar |
|
|
|
Widget _buildAppBarWidget() { |
|
|
|
Widget _buildAppBarWidget(MessageNoticeStyleModel styleModel) { |
|
|
|
return AppBar( |
|
|
|
leading: IconButton( |
|
|
|
icon: Icon( |
|
|
@@ -450,11 +536,11 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
onPressed: () => Navigator.maybePop(context), |
|
|
|
), |
|
|
|
title: Text( |
|
|
|
'消息中心', |
|
|
|
style: TextStyle(color: HexColor.fromHex('#333333'), fontSize: 15, fontWeight: FontWeight.bold), |
|
|
|
styleModel?.isFist ?? true ? styleModel?.app_bar_name ?? '消息中心' : styleModel?.styleTitle ?? '', |
|
|
|
style: TextStyle(color: HexColor.fromHex(styleModel?.app_bar_name_color ?? '#333333'), fontSize: 15, fontWeight: FontWeight.bold), |
|
|
|
), |
|
|
|
centerTitle: true, |
|
|
|
backgroundColor: HexColor.fromHex('#FFFFFF'), |
|
|
|
backgroundColor: HexColor.fromHex(styleModel?.app_bar_bg_color ?? '#FFFFFF'), |
|
|
|
elevation: 0, |
|
|
|
); |
|
|
|
} |
|
|
@@ -477,7 +563,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
), |
|
|
|
), |
|
|
|
Visibility( |
|
|
|
visible: !EmptyUtil.isEmpty(value), |
|
|
|
visible: !EmptyUtil.isEmpty(value) && value != '0', |
|
|
|
child: Transform.translate( |
|
|
|
offset: Offset(5, -4.5), |
|
|
|
child: Container( |
|
|
@@ -502,27 +588,24 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel) { |
|
|
|
Map<String, String> datas = { |
|
|
|
'订单编号:': '154547896541651464788', |
|
|
|
'订单类型:': '京东', |
|
|
|
'预估收益:': '8.00', |
|
|
|
'下单时间:': '2020-08-14 11:35:39', |
|
|
|
'预估结算:': '次月25日结算', |
|
|
|
}; |
|
|
|
Widget _buildCustomerTradeContentWidget(TransactionNotificationStyle styleModel, List<TransactionBodyItemModel> transactions) { |
|
|
|
List<Widget> lists = []; |
|
|
|
datas.forEach((key, value) { |
|
|
|
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: key, style: TextStyle(fontSize: 11, color: HexColor.fromHex('#999999'))), |
|
|
|
TextSpan(text: value, style: TextStyle(fontSize: 11, color: HexColor.fromHex('#999999'))), |
|
|
|
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, |
|
|
|