123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282 |
- import 'package:flutter/material.dart';
- import 'package:liftmanager/internal/wode/model/message_model.dart';
- import 'package:liftmanager/internal/wode/page/notice_list.dart';
- import 'package:liftmanager/net/api_service.dart';
- import 'package:liftmanager/res/iconfont.dart';
- import 'package:liftmanager/utils/toast.dart';
- import 'package:liftmanager/widgets/app_bar.dart';
- import 'package:umeng_common_sdk/umeng_common_sdk.dart';
- class MessageCenter extends StatefulWidget {
- @override
- MessageCenterState createState() => MessageCenterState();
- }
- class MessageCenterState extends State<MessageCenter> {
- MessageOverview overview;
- @override
- void initState() {
- UmengCommonSdk.onPageStart("消息中心");
- super.initState();
- getMessageOverview();
- }
- @override
- void dispose() {
- UmengCommonSdk.onPageEnd("消息中心");
- super.dispose();
- }
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- // resizeToAvoidBottomPadding: true,
- appBar: MyAppBar(
- centerTitle: "消息中心",
- ),
- body: Container(
- padding: EdgeInsets.symmetric(horizontal: 10),
- child: Column(
- children: [
- GestureDetector(
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Container(
- child: Stack(
- overflow: Overflow.visible,
- children: [
- ClipRRect(
- borderRadius: BorderRadius.circular(20),
- child: Container(
- width: 40,
- height: 40,
- decoration: BoxDecoration(
- color: Color(0xffFDAF2C),
- ),
- // padding: EdgeInsets.only(right:10),
- child: Icon(
- Iconfont.tongzhi,
- size: 17.0,
- color: Colors.white,
- ),
- ),
- ),
- if (overview != null &&
- overview.systemMessageUnreadCount > 0)
- Positioned(
- right: -5,
- top: -1,
- child: Container(
- height: 14,
- padding: EdgeInsets.symmetric(horizontal: 5),
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: Color(0xffF94F45),
- borderRadius: BorderRadius.circular(7),
- ),
- child: Text(
- '${overview.systemMessageUnreadCount}',
- style: TextStyle(
- color: Color(0xffffffff), fontSize: 10),
- ),
- ),
- )
- ],
- ),
- ),
- Expanded(
- child: Column(
- children: <Widget>[
- SizedBox(
- height: 20,
- ),
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- SizedBox(
- width: 10,
- ),
- Text(
- "系统消息",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff333333),
- ),
- ),
- Spacer(),
- Text(
- "${overview?.systemMessageModel?.createTime ?? ''}",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 12,
- color: Color(0xffCCCCCC),
- ),
- ),
- ],
- ),
- SizedBox(
- height: 5,
- ),
- Row(
- children: <Widget>[
- SizedBox(
- width: 10,
- ),
- Container(
- child: Text(
- "${overview?.systemMessageModel?.content ?? ''}",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 13,
- color: Color(0xff999999),
- ),
- overflow: TextOverflow.ellipsis,
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- SizedBox(
- height: 20,
- ),
- Divider(),
- SizedBox(
- height: 20,
- ),
- GestureDetector(
- onTap: () async {
- await Navigator.push(context,
- MaterialPageRoute(builder: (context) => NoticeList()));
- getMessageOverview();
- },
- child: Container(
- color: Colors.white,
- child: Row(
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Container(
- child: Stack(
- overflow: Overflow.visible,
- children: [
- ClipRRect(
- borderRadius: BorderRadius.circular(20),
- child: Container(
- width: 40,
- height: 40,
- decoration: BoxDecoration(
- color: Color(0xff5589FF),
- ),
- // padding: EdgeInsets.only(right:10),
- child: Icon(
- Iconfont.tongzhi,
- size: 17.0,
- color: Colors.white,
- ),
- ),
- ),
- if (overview != null &&
- overview.notificationMessageUnreadCount > 0)
- Positioned(
- right: -5,
- top: -1,
- child: Container(
- height: 14,
- padding: EdgeInsets.symmetric(horizontal: 5),
- alignment: Alignment.center,
- decoration: BoxDecoration(
- color: Color(0xffF94F45),
- borderRadius: BorderRadius.circular(7),
- ),
- child: Text(
- '${overview.notificationMessageUnreadCount}',
- style: TextStyle(
- color: Color(0xffffffff), fontSize: 10),
- ),
- ),
- )
- ],
- ),
- ),
- Expanded(
- child: Column(
- children: <Widget>[
- Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- children: <Widget>[
- SizedBox(
- width: 10,
- ),
- Text(
- "通知消息",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 14,
- color: Color(0xff333333),
- ),
- ),
- Spacer(),
- Text(
- "${overview?.notificationMessageModel?.createTime ?? ''}",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 12,
- color: Color(0xffCCCCCC),
- ),
- ),
- ],
- ),
- SizedBox(
- height: 5,
- ),
- Row(
- children: <Widget>[
- SizedBox(
- width: 10,
- ),
- Container(
- child: Text(
- "${overview?.notificationMessageModel?.content ?? ''}",
- textAlign: TextAlign.left,
- style: TextStyle(
- fontSize: 13,
- color: Color(0xff999999),
- ),
- overflow: TextOverflow.ellipsis,
- ),
- ),
- ],
- ),
- ],
- ),
- ),
- ],
- ),
- ),
- ),
- SizedBox(
- height: 20,
- ),
- Divider(),
- ],
- ),
- ));
- }
- getMessageOverview() {
- NewApiService().getMessageOverview(onSuccess: (res) {
- setState(() {
- overview = res;
- });
- }, onError: (code, msg) {
- toasts(msg);
- });
- }
- }
|