diff --git a/assets/message/ic_star.png b/assets/message/ic_star.png new file mode 100644 index 0000000..4ea81a9 Binary files /dev/null and b/assets/message/ic_star.png differ diff --git a/lib/ui/home/messages/comment_message.dart b/lib/ui/home/messages/comment_message.dart new file mode 100644 index 0000000..ddcfc86 --- /dev/null +++ b/lib/ui/home/messages/comment_message.dart @@ -0,0 +1,146 @@ +import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; +import 'package:aku_ui/common_widgets/aku_common_widgets.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:aku_community_manager/const/resource.dart'; +class CommentMessage extends StatefulWidget { + CommentMessage({Key key}) : super(key: key); + + @override + _CommentMessageState createState() => _CommentMessageState(); +} + +class _CommentMessageState extends State { + Widget _messageList(String date, String name, String comment,) { + return Column( + children: [ + Container( + alignment: Alignment.center, + width: double.infinity, + height: 48.w + 33.w, + child: Text( + date, + style: TextStyle(color: AppStyle.minorTextColor, fontSize: 24.sp), + ), + ), + Container( + padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 24.w), + color: Color(0xFFFFFFFF), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row(children: [ + Container( + width: 16.w, + height: 16.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + color: Color(0xFFFF4501)), + ), + SizedBox( + width: 16.w, + ), + Text( + '系统通知', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 32.sp, + fontWeight: FontWeight.w600), + ), + SizedBox(height: 8.w), + ]), + Text( + '你有一条新的报事报修,请立即处理', + style: TextStyle( + color: AppStyle.primaryTextColor, + fontSize: 28.sp, + fontWeight: FontWeight.bold), + ), + SizedBox(height: 24.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text( + '评论人', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp), + ), + Spacer(), + Text( + name, + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp), + ), + ], + ), + SizedBox(height: 16.w), + Row( + children: [ + Image.asset( + R.ASSETS_MESSAGE_IC_STAR_PNG, + width: 40.w, + height: 40.w, + ), + SizedBox( + width: 4.w, + ), + Text('综合评分', + style: TextStyle( + color: AppStyle.minorTextColor, fontSize: 28.sp)), + Spacer(), + Text(comment, + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp)), + ], + ), + SizedBox(height: 16.w), + Divider( + height: 1.w, + ), + AkuButton( + onPressed: () {}, + child: Container( + height: 88.w, + alignment: Alignment.center, + padding: EdgeInsets.only(left: 24.w), + child: Row( + children: [ + Text( + '查看详情', + style: TextStyle( + color: AppStyle.primaryTextColor, fontSize: 28.sp), + ), + Spacer(), + Icon(Icons.arrow_forward_ios, size: 22.w), + ], + ), + ), + ), + ], + ), + ), + ], + ); + } + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '评论消息', + body: ListView( + padding: EdgeInsets.all(32.w), + children: [ + _messageList('2020-10-23 10:00', '杨建', '四星'), + _messageList('2020-10-24 11:00', '刘能', '四星'), + ], + ), + ); + } +} \ No newline at end of file diff --git a/lib/ui/home/messages/message.dart b/lib/ui/home/messages/message.dart index ef977f8..a77e093 100644 --- a/lib/ui/home/messages/message.dart +++ b/lib/ui/home/messages/message.dart @@ -1,5 +1,6 @@ import 'package:aku_community_manager/const/resource.dart'; import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/home/messages/comment_message.dart'; import 'package:aku_community_manager/ui/home/messages/system_message.dart'; import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_ui/aku_ui.dart'; @@ -16,107 +17,110 @@ class Message extends StatefulWidget { } class _MessageState extends State { - - Widget _messageTypeImage(String type){ + Widget _messageTypeImage(String type) { String path; Color ca; Color cb; - switch (type) { - case'系统消息' : - path=R.ASSETS_MESSAGE_IC_TONGZHI_PNG; - ca=Color(0xFFFFDE9A); - cb=Color(0xFFFFB00A); + switch (type) { + case '系统消息': + path = R.ASSETS_MESSAGE_IC_TONGZHI_PNG; + ca = Color(0xFFFFDE9A); + cb = Color(0xFFFFB00A); + break; + case '评论消息': + path = R.ASSETS_MESSAGE_IC_PINGLUN_PNG; + ca = Color(0xFF81D1FF); + cb = Color(0xFF1792FF); break; - case '评论消息': - path=R.ASSETS_MESSAGE_IC_PINGLUN_PNG; - ca=Color(0xFF81D1FF); - cb=Color(0xFF1792FF); - break; default: } return Container( - width: 88.w, - height: 88.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(44.w), - gradient: LinearGradient( - begin: Alignment.topCenter, - end: Alignment.bottomCenter, - colors: [ - ca, - cb, - ]), - ), - child: Image.asset(path,width: 70.w,height: 70.w,), - ); + width: 88.w, + height: 88.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(44.w), + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + ca, + cb, + ]), + ), + child: Image.asset( + path, + width: 70.w, + height: 70.w, + ), + ); } - Widget _messageListTile(String date, Widget messageImage, String title,String text,int number,Widget page) { + + Widget _messageListTile( + String date, Widget messageImage, String title, String text, int number, + {VoidCallback onpressed}) { return AkuButton( - color: Color(0xFFFFFFFF), - onPressed: () { - Get.to(page); - }, - child: Container( - height: 136.w, - padding: EdgeInsets.only( - top: 24.w, - left: 32.w, - bottom: 24.w, - right: 31.w, + color: Color(0xFFFFFFFF), + onPressed: onpressed, + child: Container( + height: 136.w, + padding: EdgeInsets.only( + top: 24.w, + left: 32.w, + bottom: 24.w, + right: 31.w, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + messageImage, + SizedBox( + width: 24.w, ), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - messageImage, - SizedBox( - width: 24.w, - ), - Expanded( - child: Column( - mainAxisSize: MainAxisSize.min, + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( children: [ - Row( - children: [ - Text( - title, - style: AppStyle().primaryStyle, - ), - Spacer(), - Text(date, style: AppStyle().minorStyle), - ], + Text( + title, + style: AppStyle().primaryStyle, ), Spacer(), - Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [ - Text(text, style: AppStyle().minorStyle), - Spacer(), - Container( - alignment: Alignment.center, - width: 32.w, - height: 32.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(16.w), - color: Color(0xFFFF4501)), - child: Text( - number.toString(), - style: TextStyle( - color: Color(0xFFFFFFFF), - fontSize: 20.sp, - ), - ), + Text(date, style: AppStyle().minorStyle), + ], + ), + Spacer(), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Text(text, style: AppStyle().minorStyle), + Spacer(), + Container( + alignment: Alignment.center, + width: 32.w, + height: 32.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(16.w), + color: Color(0xFFFF4501)), + child: Text( + number.toString(), + style: TextStyle( + color: Color(0xFFFFFFFF), + fontSize: 20.sp, ), - ], + ), ), ], ), - ), - ], + ], + ), ), - ), - ); - - } + ], + ), + ), + ); + } @override Widget build(BuildContext context) { @@ -126,13 +130,25 @@ class _MessageState extends State { body: ListView( padding: EdgeInsets.only(top: 16.w), children: [ - _messageListTile('2020-10-23 9:00',_messageTypeImage('系统消息'), '系统消息','你有一条新的报事报修待处理' ,5,SystemMessage()), + _messageListTile('2020-10-23 9:00', _messageTypeImage('系统消息'), '系统消息', + '你有一条新的报事报修待处理', 5, onpressed: () { + Get.to(SystemMessage()); + }), Divider( height: 1.w, ), - _messageListTile('2020-10-23 10:00', _messageTypeImage('评论消息'),'评论消息', '你有一条新的评论回复',7,SystemMessage()), + _messageListTile( + '2020-10-23 10:00', + _messageTypeImage('评论消息'), + '评论消息', + '你有一条新的评论回复', + 7, + onpressed: () { + Get.to(CommentMessage()); + }, + ), ], ), ); } -} \ No newline at end of file +} diff --git a/lib/ui/home/messages/system_message.dart b/lib/ui/home/messages/system_message.dart index a839f37..97cb992 100644 --- a/lib/ui/home/messages/system_message.dart +++ b/lib/ui/home/messages/system_message.dart @@ -26,7 +26,7 @@ class _SystemMessageState extends State { ), ), Container( - padding: EdgeInsets.only(top:24.w,left:24.w,right:24.w), + padding: EdgeInsets.only(top: 24.w, left: 24.w, right: 24.w), color: Color(0xFFFFFFFF), child: Column( crossAxisAlignment: CrossAxisAlignment.start, @@ -35,7 +35,9 @@ class _SystemMessageState extends State { Container( width: 16.w, height: 16.w, - decoration: BoxDecoration(borderRadius:BorderRadius.circular(8.w),color:Color(0xFFFF4501)), + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(8.w), + color: Color(0xFFFF4501)), ), SizedBox( width: 16.w, @@ -47,7 +49,7 @@ class _SystemMessageState extends State { fontSize: 32.sp, fontWeight: FontWeight.w600), ), - SizedBox(height:8.w), + SizedBox(height: 8.w), ]), Text( '你有一条新的报事报修,请立即处理', @@ -56,10 +58,14 @@ class _SystemMessageState extends State { fontSize: 28.sp, fontWeight: FontWeight.bold), ), - SizedBox(height:24.w), + SizedBox(height: 24.w), Row( children: [ - Image.asset(R.ASSETS_MESSAGE_IC_PEOPLE_PNG,width: 40.w,height: 40.w,), + Image.asset( + R.ASSETS_MESSAGE_IC_PEOPLE_PNG, + width: 40.w, + height: 40.w, + ), SizedBox( width: 4.w, ), @@ -76,10 +82,14 @@ class _SystemMessageState extends State { ), ], ), - SizedBox(height:16.w), + SizedBox(height: 16.w), Row( children: [ - Image.asset(R.ASSETS_MESSAGE_IC_PHONE_PNG,width: 40.w,height: 40.w,), + Image.asset( + R.ASSETS_MESSAGE_IC_PHONE_PNG, + width: 40.w, + height: 40.w, + ), SizedBox( width: 4.w, ), @@ -92,10 +102,14 @@ class _SystemMessageState extends State { color: AppStyle.primaryTextColor, fontSize: 28.sp)), ], ), - SizedBox(height:16.w), + SizedBox(height: 16.w), Row( children: [ - Image.asset(R.ASSETS_MESSAGE_IC_AREA_PNG,width: 40.w,height: 40.w,), + Image.asset( + R.ASSETS_MESSAGE_IC_AREA_PNG, + width: 40.w, + height: 40.w, + ), SizedBox( width: 4.w, ), @@ -108,12 +122,12 @@ class _SystemMessageState extends State { color: AppStyle.primaryTextColor, fontSize: 28.sp)), ], ), - SizedBox(height:16.w), - Divider(height: 1.w,), + SizedBox(height: 16.w), + Divider( + height: 1.w, + ), AkuButton( - onPressed: () { - - }, + onPressed: () {}, child: Container( height: 88.w, alignment: Alignment.center,