Просмотр исходного кода

1、消息中心的model类报错修复

tags/0.0.17+8^0
PH2 3 лет назад
Родитель
Сommit
f719669208
2 измененных файлов: 19 добавлений и 14 удалений
  1. +10
    -10
      lib/pages/message_notice_page/message_notice_page.dart
  2. +9
    -4
      lib/pages/message_notice_page/model/message_notice_data_model.dart

+ 10
- 10
lib/pages/message_notice_page/message_notice_page.dart Просмотреть файл

@@ -56,7 +56,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
void _onMainItemClick(MainNotificationStyleItem styleModel, MessageNoticeDataItemModel dataModel) { void _onMainItemClick(MainNotificationStyleItem styleModel, MessageNoticeDataItemModel dataModel) {
/// 消除消息红点 /// 消除消息红点
BlocProvider.of<MessageNoticeBloc>(context).add(MessageNoticeClearPointEvent(selectId: dataModel?.id.toString())); BlocProvider.of<MessageNoticeBloc>(context).add(MessageNoticeClearPointEvent(selectId: dataModel?.id.toString()));
print('NoticePageType = ' + styleModel?.type + ', NoticePageName = ' + styleModel?.name);
/// 如果是消息中心,则重新打开页面加载 /// 如果是消息中心,则重新打开页面加载
Navigator.push(context, CupertinoPageRoute(builder: (_) => MessageNoticePage({'NoticePageType': styleModel?.type, 'NoticePageTitle': styleModel?.name}))); Navigator.push(context, CupertinoPageRoute(builder: (_) => MessageNoticePage({'NoticePageType': styleModel?.type, 'NoticePageTitle': styleModel?.name})));
} }
@@ -259,7 +259,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
padding: const EdgeInsets.only(right: 22), padding: const EdgeInsets.only(right: 22),
child: Text( child: Text(
//'2020年6月23日4:00至6月30日4:00关闭提现aaa', //'2020年6月23日4:00至6月30日4:00关闭提现aaa',
dataModel?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(color: HexColor.fromHex(styleModel?.value_color ?? '#999999'), fontSize: 12), style: TextStyle(color: HexColor.fromHex(styleModel?.value_color ?? '#999999'), fontSize: 12),
@@ -304,14 +304,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
children: <Widget>[ children: <Widget>[
/// 标题 /// 标题
Text( Text(
dataModel?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold),
), ),
const SizedBox(height: 5), const SizedBox(height: 5),


/// 内容 /// 内容
Text( Text(
dataModel?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
maxLines: 3, maxLines: 3,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11), style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11),
@@ -361,14 +361,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
children: <Widget>[ children: <Widget>[
/// 标题 /// 标题
Text( Text(
dataModel?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold),
), ),
const SizedBox(height: 5), const SizedBox(height: 5),


/// 内容 /// 内容
Text( Text(
dataModel?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
maxLines: 3, maxLines: 3,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11), style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11),
@@ -406,7 +406,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
children: <Widget>[ children: <Widget>[
/// 标题 /// 标题
Text( Text(
dataModel?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 14), style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 14),
maxLines: 1, maxLines: 1,
overflow: TextOverflow.ellipsis, overflow: TextOverflow.ellipsis,
@@ -464,7 +464,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
/// 标题 /// 标题
Text(dataModel?.messageContent.title ?? '',
Text(dataModel?.messageContent?.title ?? '',
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)),
const SizedBox(height: 5), const SizedBox(height: 5),


@@ -512,7 +512,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
children: <Widget>[ children: <Widget>[
/// 标题 /// 标题
Text( Text(
dataModel?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold), style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold),
), ),
const SizedBox(height: 5), const SizedBox(height: 5),
@@ -565,7 +565,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
/// 标题 /// 标题
Text(dataModel?.messageContent.title ?? '',
Text(dataModel?.messageContent?.title ?? '',
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)), style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontSize: 14, fontWeight: FontWeight.bold)),
const SizedBox(height: 3), const SizedBox(height: 3),




+ 9
- 4
lib/pages/message_notice_page/model/message_notice_data_model.dart Просмотреть файл

@@ -1,4 +1,6 @@
import 'dart:convert' as Con;
// import 'dart:convert' as Con;
import 'dart:convert';
import 'package:zhiying_comm/zhiying_comm.dart';


class MessageNoticeDataModel { class MessageNoticeDataModel {
List<MessageNoticeDataItemModel> list; List<MessageNoticeDataItemModel> list;
@@ -45,9 +47,12 @@ class MessageNoticeDataItemModel {
skipIdentifier = json['skip_identifier']; skipIdentifier = json['skip_identifier'];
status = json['status']; status = json['status'];
dateTime = json['date_time']; dateTime = json['date_time'];
if(json['content']!=null){
messageContent=MessageContent.fromJson(Con.json.decode(json['content']));
}
// if(json['content']!=null){
// messageContent=MessageContent.fromJson(Con.json.decode(json['content']));
// }
messageContent = !EmptyUtil.isEmpty(json['content']) && jsonDecode(json['content']) != null ?
MessageContent.fromJson(jsonDecode(json['content'])) :
null;
} }


Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {


Загрузка…
Отмена
Сохранить