添加 评论通知页

对接:查询所有的评论通知
hmxc
张萌 4 years ago
parent 4cc762e7d5
commit e3b97098cb

@ -242,4 +242,11 @@ class _Message {
///idid
String get getSystemMessageDetial => '/user/message/sysMessageDetail';
///
String get commentMessageList => '/user/message/sysCommentMessageList';
///()
String get allReadComment => '/user/message/allReadComment';
}

@ -0,0 +1,87 @@
class CommentMessageModel {
int id;
int gambitThemeId;
String respondentName;
int type;
String content;
int receiverAccount;
int sendStatus;
String createName;
String createDate;
List<ImgUrls> imgUrls;
CommentMessageModel(
{this.id,
this.gambitThemeId,
this.respondentName,
this.type,
this.content,
this.receiverAccount,
this.sendStatus,
this.createName,
this.createDate,
this.imgUrls});
CommentMessageModel.fromJson(Map<String, dynamic> json) {
id = json['id'];
gambitThemeId = json['gambitThemeId'];
respondentName = json['respondentName'];
type = json['type'];
content = json['content'];
receiverAccount = json['receiverAccount'];
sendStatus = json['sendStatus'];
createName = json['createName'];
createDate = json['createDate'];
if (json['imgUrls'] != null) {
imgUrls = new List<ImgUrls>();
json['imgUrls'].forEach((v) {
imgUrls.add(new ImgUrls.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['gambitThemeId'] = this.gambitThemeId;
data['respondentName'] = this.respondentName;
data['type'] = this.type;
data['content'] = this.content;
data['receiverAccount'] = this.receiverAccount;
data['sendStatus'] = this.sendStatus;
data['createName'] = this.createName;
data['createDate'] = this.createDate;
if (this.imgUrls != null) {
data['imgUrls'] = this.imgUrls.map((v) => v.toJson()).toList();
}
return data;
}
}
class ImgUrls {
String url;
String size;
int longs;
int paragraph;
int sort;
ImgUrls({this.url, this.size, this.longs, this.paragraph, this.sort});
ImgUrls.fromJson(Map<String, dynamic> json) {
url = json['url'];
size = json['size'];
longs = json['longs'];
paragraph = json['paragraph'];
sort = json['sort'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
data['size'] = this.size;
data['longs'] = this.longs;
data['paragraph'] = this.paragraph;
data['sort'] = this.sort;
return data;
}
}

@ -0,0 +1,46 @@
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/message/comment_message_model.dart';
import 'package:akuCommunity/pages/things_page/widget/bee_list_view.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
class CommentMessagePage extends StatefulWidget {
CommentMessagePage({Key key}) : super(key: key);
@override
_CommentMessagePageState createState() => _CommentMessagePageState();
}
class _CommentMessagePageState extends State<CommentMessagePage> {
EasyRefreshController _easyRefreshController;
@override
void initState() {
super.initState();
_easyRefreshController = EasyRefreshController();
}
@override
void dispose() {
_easyRefreshController?.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '评论通知',
body: BeeListView(
path: API.message.commentMessageList,
controller: _easyRefreshController,
convert: (models) {
return models.tableList
.map((e) => CommentMessageModel.fromJson(e))
.toList();
},
builder: (items) {
return Container();
}),
);
}
}

@ -1,193 +0,0 @@
// Flutter imports:
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
// Package imports:
import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:velocity_x/velocity_x.dart';
// Project imports:
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
//TODO CLEAN BOTTOM CODES.
@Deprecated("sh*t comment_message_page need to be cleaned.")
class CommentMessagePage extends StatefulWidget {
CommentMessagePage({Key key}) : super(key: key);
@override
_CommentMessagePageState createState() => _CommentMessagePageState();
}
class _CommentMessagePageState extends State<CommentMessagePage> {
RefreshController _refreshController =
RefreshController(initialRefresh: false);
List<Map<String, dynamic>> _listNotice = [
{
'name': '马泽鹏',
'imageHeader': 'assets/example/touxiang1.png',
'content': '教师节,我们为老师唱首歌吧,顺便给老师过生日。',
'time': '1分钟前',
'imagePath': 'assets/example/jiaoshijie.png'
},
{
'name': '周玲慧',
'imageHeader': 'assets/example/touxiang2.png',
'content': '回复了马泽鹏: 小马好主意',
'time': '10分钟前',
'imagePath': 'assets/example/jiaoshijie.png'
},
{
'name': '王珂',
'imageHeader': 'assets/example/touxiang1.png',
'content': '教师节,我们为老师唱首歌吧,顺便给老师过生日。',
'time': '20分钟前',
'imagePath': 'assets/example/jiaoshijie.png'
},
{
'name': '王珂',
'imageHeader': 'assets/example/touxiang1.png',
'content': '回复了马泽鹏: 小马就是鬼主意多',
'time': '昨天 20:23',
'imagePath': 'assets/example/jiaoshijie.png'
},
];
@override
void initState() {
super.initState();
}
void _onRefresh() async {
await Future.delayed(Duration(milliseconds: 1500));
_refreshController.refreshCompleted();
}
void _onLoading() async {
await Future.delayed(Duration(milliseconds: 1500));
if (mounted) setState(() {});
_refreshController.loadComplete();
}
@override
void dispose() {
super.dispose();
_refreshController.dispose();
}
Container _containerCommentCard(
String name, imageHeader, content, time, imagePath) {
return Container(
margin: EdgeInsets.symmetric(horizontal: 32.w),
padding: EdgeInsets.only(
top: 32.w,
bottom: 16.w,
),
decoration: BoxDecoration(
border: Border(
bottom: Divider.createBorderSide(context,
color: Color(0xffe5e5e5), width: 0.5),
),
),
child: Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.all(Radius.circular(4)),
),
child: Image.asset(
imageHeader,
height: 86.w,
width: 86.w,
fit: BoxFit.fill,
),
),
SizedBox(width: 20.w),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
name,
style: TextStyle(
fontSize: 36.sp,
color: Color(0xff333333),
),
),
SizedBox(height: 6.w),
Container(
width: 392.w,
child: Text(
content,
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: 28.sp,
color: Color(0xff333333),
),
),
),
SizedBox(height: 16.w),
Text(
time,
style: TextStyle(
fontSize: 28.sp,
color: Color(0xff999999),
),
),
],
),
SizedBox(width: 12.w),
Image.asset(
imagePath,
height: 158.w,
width: 158.w,
fit: BoxFit.fill,
),
],
),
);
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '评论通知',
actions: [
InkWell(
onTap: () {},
child: Container(
padding: EdgeInsets.fromLTRB(32.w, 28.w, 32.w, 20.w),
child: '清空'.text.black.size(28.sp).make(),
alignment: Alignment.center,
),
)
],
body: Container(
color: Colors.white,
child: RefreshConfiguration(
hideFooterWhenNotFull: true,
child: SmartRefresher(
controller: _refreshController,
header: WaterDropHeader(),
footer: ClassicFooter(),
onRefresh: _onRefresh,
onLoading: _onLoading,
enablePullUp: true,
child: ListView.builder(
itemBuilder: (context, index) => _containerCommentCard(
_listNotice[index]['name'],
_listNotice[index]['imageHeader'],
_listNotice[index]['content'],
_listNotice[index]['time'],
_listNotice[index]['imagePath'],
),
itemCount: _listNotice.length,
),
),
),
),
);
}
}

@ -1,4 +1,5 @@
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/pages/message_center_page/comment_message/comment_message_page.dart';
import 'package:akuCommunity/pages/message_center_page/system_message/system_message_page.dart';
import 'package:akuCommunity/provider/app_provider.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
@ -105,6 +106,10 @@ class _MessageCenterPageState extends State<MessageCenterPage> {
content:
appProvider.messageCenterModel.commentTitle ?? '无评论通知消息',
count: appProvider.messageCenterModel.commentCount ?? 0,
onTap: () async {
await NetUtil().dio.get(API.message.allReadComment);
CommentMessagePage().to();
},
),
// _buildCard(
// path: R.ASSETS_ICONS_SHOP_NOTICE_PNG,

Loading…
Cancel
Save