From dd6c988683a08748df24d735906a09c0a96bc8a6 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Fri, 2 Apr 2021 17:51:07 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B6=88=E6=81=AF=E4=B8=AD=E5=BF=83=E8=B7=B3?= =?UTF-8?q?=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../community_views/community_page.dart | 4 +- lib/ui/message/message_center.dart | 104 ------------------ 2 files changed, 2 insertions(+), 106 deletions(-) delete mode 100644 lib/ui/message/message_center.dart diff --git a/lib/ui/community/community_views/community_page.dart b/lib/ui/community/community_views/community_page.dart index 4b3de518..67bd0e12 100644 --- a/lib/ui/community/community_views/community_page.dart +++ b/lib/ui/community/community_views/community_page.dart @@ -1,3 +1,4 @@ +import 'package:akuCommunity/pages/message_center_page/message_center_page.dart'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; @@ -8,7 +9,6 @@ import 'package:akuCommunity/ui/community/community_views/add_new_event_page.dar import 'package:akuCommunity/ui/community/community_views/my_community_view.dart'; import 'package:akuCommunity/ui/community/community_views/new_community_view.dart'; import 'package:akuCommunity/ui/community/community_views/topic/topic_community_view.dart'; -import 'package:akuCommunity/ui/message/message_center.dart'; import 'package:akuCommunity/utils/headers.dart'; import 'package:akuCommunity/utils/login_util.dart'; import 'package:akuCommunity/widget/bee_scaffold.dart'; @@ -59,7 +59,7 @@ class _CommunityPageState extends State ColumnActionButton( onPressed: () { if (LoginUtil.isNotLogin) return; - Get.to(() => MessageCenter()); + Get.to(() => MessageCenterPage()); }, title: '消息', path: R.ASSETS_ICONS_ALARM_PNG, diff --git a/lib/ui/message/message_center.dart b/lib/ui/message/message_center.dart deleted file mode 100644 index 65c4ea7d..00000000 --- a/lib/ui/message/message_center.dart +++ /dev/null @@ -1,104 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:flutter/rendering.dart'; - -import 'package:badges/badges.dart'; -import 'package:dio/dio.dart'; -import 'package:flustars/flustars.dart'; -import 'package:flutter_easyrefresh/easy_refresh.dart'; -import 'package:velocity_x/velocity_x.dart'; - -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/net_util.dart'; -import 'package:akuCommunity/widget/bee_scaffold.dart'; - -class MessageCenter extends StatefulWidget { - MessageCenter({Key key}) : super(key: key); - - @override - _MessageCenterState createState() => _MessageCenterState(); -} - -class _MessageCenterState extends State { - MessageCenterModel _model; - - Widget _buildMessageTile({ - String title, - String content, - int count, - String path, - }) { - bool empty = count == null || count == 0; - return Row( - children: [ - Badge( - elevation: 0, - position: BadgePosition(top: 8.w, end: 8.w), - showBadge: !empty, - child: Image.asset( - path, - height: 90.w, - width: 90.w, - ), - ), - 12.wb, - Column( - crossAxisAlignment: CrossAxisAlignment.start, - children: [ - title.text.size(32.sp).bold.make(), - 4.hb, - (TextUtil.isEmpty(content) ? '没有新通知' : content) - .text - .size(28.sp) - .make(), - ], - ).expand(), - ], - ).pSymmetric(h: 32.w, v: 18.w); - } - - Future _getMessageCenter() async { - Response response = await NetUtil().dio.get(API.message.center); - return MessageCenterModel.fromJson(response.data); - } - - @override - Widget build(BuildContext context) { - return BeeScaffold( - title: '消息中心', - actions: [ - MaterialButton( - onPressed: () {}, - child: '全部已读'.text.size(28.sp).make(), - ), - ], - body: EasyRefresh( - header: MaterialHeader(), - firstRefresh: true, - onRefresh: () async { - _model = await _getMessageCenter(); - setState(() {}); - }, - child: _model == null - ? SizedBox() - : ListView( - children: [ - _buildMessageTile( - title: '系统通知', - path: R.ASSETS_ICONS_SYSTEM_NOTICE_PNG, - 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), - ); - } -}