添加消息中心

hmxc
小赖 4 years ago
parent 1e66c49bbf
commit 186a448710

@ -1,4 +1,5 @@
// Flutter imports: // Flutter imports:
import 'package:akuCommunity/ui/message/message_center.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
// Package imports: // Package imports:
@ -46,7 +47,7 @@ class _CommunityPageState extends State<CommunityPage>
title: '社区', title: '社区',
actions: [ actions: [
ColumnActionButton( ColumnActionButton(
onPressed: () {}, onPressed: MessageCenter().to,
title: '消息', title: '消息',
path: R.ASSETS_ICONS_ALARM_PNG, path: R.ASSETS_ICONS_ALARM_PNG,
), ),

@ -0,0 +1,88 @@
import 'package:akuCommunity/utils/headers.dart';
import 'package:akuCommunity/widget/bee_scaffold.dart';
import 'package:badges/badges.dart';
import 'package:common_utils/common_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyrefresh/easy_refresh.dart';
import 'package:velocity_x/velocity_x.dart';
class MessageCenter extends StatefulWidget {
MessageCenter({Key key}) : super(key: key);
@override
_MessageCenterState createState() => _MessageCenterState();
}
class _MessageCenterState extends State<MessageCenter> {
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);
}
_getMessageCenter()async{
}
@override
Widget build(BuildContext context) {
return BeeScaffold(
title: '消息中心',
actions: [
MaterialButton(
onPressed: () {},
child: '全部已读'.text.size(28.sp).make(),
),
],
body: EasyRefresh(
header: MaterialHeader(),
onRefresh: () async {},
child: 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,
),
].sepWidget(separate: Divider(indent: 32.w, endIndent: 32.w)),
),
).material(color: Colors.white),
);
}
}

@ -85,6 +85,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "2.1.0" version: "2.1.0"
badges:
dependency: "direct main"
description:
name: badges
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.6"
boolean_selector: boolean_selector:
dependency: transitive dependency: transitive
description: description:

@ -96,6 +96,7 @@ dependencies:
url: http://192.168.2.201:8099/aku_fe/power_logger.git url: http://192.168.2.201:8099/aku_fe/power_logger.git
flutter_rating_bar: ^3.2.0+1 flutter_rating_bar: ^3.2.0+1
jpush_flutter: ^0.6.3 jpush_flutter: ^0.6.3
badges: ^1.1.6
dev_dependencies: dev_dependencies:
flutter_test: flutter_test:

Loading…
Cancel
Save