Selaa lähdekoodia

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

tags/0.0.17+8^0
PH2 3 vuotta sitten
vanhempi
commit
f719669208
2 muutettua tiedostoa jossa 19 lisäystä ja 14 poistoa
  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 Näytä tiedosto

@@ -56,7 +56,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
void _onMainItemClick(MainNotificationStyleItem styleModel, MessageNoticeDataItemModel dataModel) {
/// 消除消息红点
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})));
}
@@ -259,7 +259,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
padding: const EdgeInsets.only(right: 22),
child: Text(
//'2020年6月23日4:00至6月30日4:00关闭提现aaa',
dataModel?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
maxLines: 1,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: HexColor.fromHex(styleModel?.value_color ?? '#999999'), fontSize: 12),
@@ -304,14 +304,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
children: <Widget>[
/// 标题
Text(
dataModel?.messageContent.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?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11),
@@ -361,14 +361,14 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
children: <Widget>[
/// 标题
Text(
dataModel?.messageContent.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?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
maxLines: 3,
overflow: TextOverflow.ellipsis,
style: TextStyle(color: HexColor.fromHex(styleModel?.message_value_color ?? '#999999'), fontSize: 11),
@@ -406,7 +406,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
children: <Widget>[
/// 标题
Text(
dataModel?.messageContent.title ?? '',
dataModel?.messageContent?.title ?? '',
style: TextStyle(color: HexColor.fromHex(styleModel?.title_value_color ?? '#333333'), fontWeight: FontWeight.bold, fontSize: 14),
maxLines: 1,
overflow: TextOverflow.ellipsis,
@@ -464,7 +464,7 @@ class __MessageNoticePageContainerState extends State<_MessageNoticePageContaine
crossAxisAlignment: CrossAxisAlignment.start,
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)),
const SizedBox(height: 5),

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



+ 9
- 4
lib/pages/message_notice_page/model/message_notice_data_model.dart Näytä tiedosto

@@ -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 {
List<MessageNoticeDataItemModel> list;
@@ -45,9 +47,12 @@ class MessageNoticeDataItemModel {
skipIdentifier = json['skip_identifier'];
status = json['status'];
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() {


Ladataan…
Peruuta
Tallenna