添加系统通知页面

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

@ -16,6 +16,7 @@ class API {
static _Manager manager = _Manager(); static _Manager manager = _Manager();
static _Upload upload = _Upload(); static _Upload upload = _Upload();
static _Community community = _Community(); static _Community community = _Community();
static _Message message = _Message();
} }
class _Login { class _Login {
@ -225,3 +226,7 @@ class _Upload {
String get uploadEvent => '/user/upload/uploadGambit'; 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/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:akuCommunity/widget/bee_scaffold.dart';
import 'package:badges/badges.dart'; import 'package:badges/badges.dart';
import 'package:common_utils/common_utils.dart'; import 'package:common_utils/common_utils.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart'; import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:velocity_x/velocity_x.dart'; import 'package:velocity_x/velocity_x.dart';
@ -14,6 +20,8 @@ class MessageCenter extends StatefulWidget {
} }
class _MessageCenterState extends State<MessageCenter> { class _MessageCenterState extends State<MessageCenter> {
MessageCenterModel _model;
Widget _buildMessageTile({ Widget _buildMessageTile({
String title, String title,
String content, String content,
@ -49,8 +57,9 @@ class _MessageCenterState extends State<MessageCenter> {
).pSymmetric(h: 32.w, v: 18.w); ).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 @override
@ -65,23 +74,29 @@ class _MessageCenterState extends State<MessageCenter> {
], ],
body: EasyRefresh( body: EasyRefresh(
header: MaterialHeader(), header: MaterialHeader(),
onRefresh: () async {}, firstRefresh: true,
child: ListView( onRefresh: () async {
children: [ _model = await _getMessageCenter();
_buildMessageTile( setState(() {});
title: '系统通知', },
path: R.ASSETS_ICONS_SYSTEM_NOTICE_PNG, child: _model == null
content: '', ? SizedBox()
count: 4, : ListView(
), children: [
_buildMessageTile( _buildMessageTile(
title: '评论通知', title: '系统通知',
path: R.ASSETS_ICONS_COMMENT_NOTICE_PNG, path: R.ASSETS_ICONS_SYSTEM_NOTICE_PNG,
content: '', content: _model.sysTitle,
count: 0, count: _model.sysCount,
), ),
].sepWidget(separate: Divider(indent: 32.w, endIndent: 32.w)), // _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), ).material(color: Colors.white),
); );
} }

Loading…
Cancel
Save