添加系统通知页面

hmxc
小赖 4 years ago
parent 186a448710
commit 379db683d2

@ -16,6 +16,7 @@ class API {
static _Manager manager = _Manager();
static _Upload upload = _Upload();
static _Community community = _Community();
static _Message message = _Message();
}
class _Login {
@ -225,3 +226,7 @@ class _Upload {
String get uploadEvent => '/user/upload/uploadGambit';
}
class _Message {
String get center => '/user/message/messageCenter';
}

@ -0,0 +1,23 @@
class MessageCenterModel {
int sysCount;
String sysTitle;
MessageCenterModel.zero() {
sysCount = 0;
sysTitle = '';
}
MessageCenterModel({this.sysCount, this.sysTitle});
MessageCenterModel.fromJson(Map<String, dynamic> json) {
sysCount = json['sysCount'];
sysTitle = json['sysTitle'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['sysCount'] = this.sysCount;
data['sysTitle'] = this.sysTitle;
return data;
}
}

@ -1,8 +1,14 @@
import 'package:akuCommunity/constants/api.dart';
import 'package:akuCommunity/model/message/message_center_model.dart';
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/utils/network/base_model.dart';
import 'package:akuCommunity/utils/network/net_util.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:badges/badges.dart';
import 'package:common_utils/common_utils.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:velocity_x/velocity_x.dart';
@ -14,6 +20,8 @@ class MessageCenter extends StatefulWidget {
}
class _MessageCenterState extends State<MessageCenter> {
MessageCenterModel _model;
Widget _buildMessageTile({
String title,
String content,
@ -49,8 +57,9 @@ class _MessageCenterState extends State<MessageCenter> {
).pSymmetric(h: 32.w, v: 18.w);
}
_getMessageCenter()async{
Future<MessageCenterModel> _getMessageCenter() async {
Response response = await NetUtil().dio.get(API.message.center);
return MessageCenterModel.fromJson(response.data);
}
@override
@ -65,21 +74,27 @@ class _MessageCenterState extends State<MessageCenter> {
],
body: EasyRefresh(
header: MaterialHeader(),
onRefresh: () async {},
child: ListView(
firstRefresh: true,
onRefresh: () async {
_model = await _getMessageCenter();
setState(() {});
},
child: _model == null
? SizedBox()
: ListView(
children: [
_buildMessageTile(
title: '系统通知',
path: R.ASSETS_ICONS_SYSTEM_NOTICE_PNG,
content: '',
count: 4,
),
_buildMessageTile(
title: '评论通知',
path: R.ASSETS_ICONS_COMMENT_NOTICE_PNG,
content: '',
count: 0,
content: _model.sysTitle,
count: _model.sysCount,
),
// _buildMessageTile(
// title: '评论通知',
// path: R.ASSETS_ICONS_COMMENT_NOTICE_PNG,
// content: '',
// count: 0,
// ),
].sepWidget(separate: Divider(indent: 32.w, endIndent: 32.w)),
),
).material(color: Colors.white),

Loading…
Cancel
Save