diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 12dbc01..3b9360a 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -2,6 +2,7 @@ import 'package:aku_community_manager/provider/user_provider.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart'; +import 'package:aku_community_manager/ui/home/messages/message.dart'; import 'package:aku_community_manager/ui/home/personal_draw.dart'; import 'package:aku_community_manager/ui/tool_pages/scan_page.dart'; import 'package:aku_ui/aku_ui.dart'; @@ -201,7 +202,9 @@ class _HomePageState extends State { minWidth: 78.w, //消息按钮 height: double.infinity, - onPressed: () {}, + onPressed: () { + Get.to(Message()); + }, child: Column(children: [ Icon( Icons.access_time, diff --git a/lib/ui/home/messages/message.dart b/lib/ui/home/messages/message.dart index 4a5dcbc..ffa8a76 100644 --- a/lib/ui/home/messages/message.dart +++ b/lib/ui/home/messages/message.dart @@ -1,7 +1,12 @@ import 'package:aku_community_manager/style/app_style.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'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:get/instance_manager.dart'; +import 'package:get/get.dart'; + class Message extends StatefulWidget { Message({Key key}) : super(key: key); @@ -11,68 +16,121 @@ class Message extends StatefulWidget { class _MessageState extends State { - Widget _messageType(String type){ - switch (type) { - case'系统消息' : - return Container( - width: 88.w,height: 88.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(44.w), - gradient: LinearGradient(begin: Alignment.topCenter,end: Alignment.bottomCenter,colors: [ - Color(0xFFFFDE9A), - Color(0xFFFFB00A), - ]), - ), - child: Icon(Icons.message,size:66.w),); - break; - case '评论消息': - return Container( - width: 88.w,height: 88.w, - decoration: BoxDecoration( - borderRadius: BorderRadius.circular(44.w), - gradient: LinearGradient(begin: Alignment.topCenter,end: Alignment.bottomCenter,colors: [ - Color(0xFF81D1FF), - Color(0xFF1792FF), - ]), - ), - child: Icon(Icons.message_sharp,size:66.w),); - default: - } - } - - Widget _messageList(String date,String type){ + Widget _messageTypeImage(String type){ + Icon path; + Color ca; + Color cb; + switch (type) { + case'系统消息' : + path=Icon(Icons.system_update,size: 66.w,) ; + ca=Color(0xFFFFDE9A); + cb=Color(0xFFFFB00A); + break; + case '评论消息': + path=Icon(Icons.message,size: 66.w,) ; + ca=Color(0xFF81D1FF); + cb=Color(0xFF1792FF); + break; + default: + } return Container( - padding: EdgeInsets.only(top:24.w,left:32.w,), - child: Row( - children:[ - - SizedBox(width: 24.w,), - Column( + 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: path, + ); + } + Widget _messageListTile(String date, Widget messageImage, String title,String text,int number,Widget page) { + 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, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, children: [ - Row( - children: [ - Text('系统通知',style: AppStyle().primaryStyle,), - Spacer(), - Text(date,style:AppStyle().minorStyle), - - ], + messageImage, + SizedBox( + width: 24.w, + ), + Expanded( + child: Column( + mainAxisSize: MainAxisSize.min, + children: [ + Row( + children: [ + Text( + title, + style: AppStyle().primaryStyle, + ), + Spacer(), + 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) { return AkuScaffold( title: '消息', titleStyle: AppStyle().barTitleStyle, body: ListView( - padding: EdgeInsets.only(top:16.w), + padding: EdgeInsets.only(top: 16.w), children: [ - - ],), + _messageListTile('2020-10-23 9:00',_messageTypeImage('系统消息'), '系统消息','你有一条新的报事报修待处理' ,5,SystemMessage()), + Divider( + height: 1.w, + ), + _messageListTile('2020-10-23 10:00', _messageTypeImage('评论消息'),'评论消息', '你有一条新的评论回复',7,SystemMessage()), + ], + ), ); } } \ 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 409da8e..ccb44b8 100644 --- a/lib/ui/home/messages/system_message.dart +++ b/lib/ui/home/messages/system_message.dart @@ -1,4 +1,5 @@ import 'package:aku_community_manager/style/app_style.dart'; +import 'package:aku_community_manager/ui/widgets/common/aku_scaffold.dart'; import 'package:aku_ui/aku_ui.dart'; import 'package:flutter/material.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; @@ -19,19 +20,21 @@ class _SystemMessageState extends State { width: double.infinity, height: 48.w + 33.w, child: Text( - 'date', + date, style: TextStyle(color: AppStyle.minorTextColor, fontSize: 24.sp), ), ), Container( - padding: EdgeInsets.all(24.w), + padding: EdgeInsets.only(top:24.w,left:24.w,right:24.w), color: Color(0xFFFFFFFF), child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Row(children: [ - Icon( - Icons.point_of_sale, - size: 16.w, + Container( + width: 16.w, + height: 16.w, + decoration: BoxDecoration(borderRadius:BorderRadius.circular(8.w),color:Color(0xFFFF4501)), ), SizedBox( width: 16.w, @@ -43,7 +46,7 @@ class _SystemMessageState extends State { fontSize: 32.sp, fontWeight: FontWeight.w600), ), - Spacer(), + SizedBox(height:8.w), ]), Text( '你有一条新的报事报修,请立即处理', @@ -52,6 +55,7 @@ class _SystemMessageState extends State { fontSize: 28.sp, fontWeight: FontWeight.bold), ), + SizedBox(height:24.w), Row( children: [ Icon(Icons.contact_page, size: 40.w), @@ -71,6 +75,7 @@ class _SystemMessageState extends State { ), ], ), + SizedBox(height:16.w), Row( children: [ Icon( @@ -89,6 +94,7 @@ class _SystemMessageState extends State { color: AppStyle.primaryTextColor, fontSize: 28.sp)), ], ), + SizedBox(height:16.w), Row( children: [ Icon( @@ -107,9 +113,14 @@ class _SystemMessageState extends State { color: AppStyle.primaryTextColor, fontSize: 28.sp)), ], ), - Divider(), + 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( @@ -134,10 +145,8 @@ class _SystemMessageState extends State { @override Widget build(BuildContext context) { - return Scaffold( - appBar: AppBar( - title: Text('消息', style: AppStyle().barTitleStyle), - ), + return AkuScaffold( + title: '系统消息', body: ListView( padding: EdgeInsets.all(32.w), children: [