From 3d99005600b3f6d360b639d4c9023d226bc99f12 Mon Sep 17 00:00:00 2001 From: zhang <494089941@qq.com> Date: Mon, 2 Nov 2020 17:59:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=85=AC=E5=91=8A=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ui/home/announcement/All_anouncement.dart | 125 ++++++++++++++++++ lib/ui/home/home_page.dart | 5 +- lib/ui/home/messages/system_message.dart | 6 +- 3 files changed, 132 insertions(+), 4 deletions(-) create mode 100644 lib/ui/home/announcement/All_anouncement.dart diff --git a/lib/ui/home/announcement/All_anouncement.dart b/lib/ui/home/announcement/All_anouncement.dart new file mode 100644 index 0000000..86bf170 --- /dev/null +++ b/lib/ui/home/announcement/All_anouncement.dart @@ -0,0 +1,125 @@ +import 'dart:ui'; + +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'; +import 'package:aku_community_manager/const/resource.dart'; + +class AnouncementCard { + String title; + String date; + AnouncementCard( + this.title, + this.date, + ); +} + +class AllAnouncement extends StatefulWidget { + AllAnouncement({Key key}) : super(key: key); + + @override + _AllAnouncementState createState() => _AllAnouncementState(); +} + +class _AllAnouncementState extends State { + Widget _anounceCard(String title, String date,) { + return Column( + children: [ + AkuButton( + onPressed: (){}, + // color: Color(0xFFFFFFFF), + child: Container( + color: Color(0xFFFFFFFF), + width: double.infinity, + height: 152.w, + padding: EdgeInsets.only(top: 24.w, left: 24.w, bottom: 24.w), + child: Row( + children: [ + Container( + width: 104.w, + height: 104.w, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(52.w), + gradient: LinearGradient( + begin: Alignment.topCenter, + end: Alignment.bottomCenter, + colors: [ + Color(0xFF7EB4FF), + Color(0xFF3F8FFE), + ])), + child: Image.asset(R.ASSETS_MESSAGE_IC_TONGZHI_PNG), + ), + SizedBox( + width: 24.w, + ), + Expanded( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title,style: AppStyle().primaryStyle,), + SizedBox(height: 12.w), + Row( + children: [ + Text('智慧管家', style: AppStyle().minorStyle), + SizedBox( + width: 24.w, + ), + Text( + date, + style: AppStyle().minorStyle, + ), + Spacer(), + ], + ), + ], + ), + ), + ], + ), + ), + ), + SizedBox(height: 16.w,), + ], + ); + } + + Widget _anouncementList(String date, List cards,) { + return Column( + children: [ + Container( + alignment: Alignment.center, + width: double.infinity, + height: 24.w + 33.w, + child: Text( + date, + style: AppStyle().minorStyle, + )), + ...(cards + .map( + (e) => _anounceCard(e.title, e.date), + ) + .toList()), + ], + ); + } + + @override + Widget build(BuildContext context) { + return AkuScaffold( + title: '全部公告', + body: ListView( + padding: EdgeInsets.only(top: 24.w, left: 32.w, right: 32.w), + children: [ + _anouncementList('2020-10-22', [ + AnouncementCard('关于国庆放假的通知和安排', '2020-10-22 10:00',), + AnouncementCard('关于绿化组人员调动通知', '2020-10-22 11:00',), + ]), + _anouncementList('2020-10-20', []) + ], + ), + ); + } +} diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 46294d6..a1bf500 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -3,6 +3,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/announcement/All_anouncement.dart'; import 'package:aku_community_manager/ui/home/messages/message.dart'; import 'package:aku_community_manager/ui/home/application/applications_page.dart'; import 'package:aku_community_manager/ui/home/personal_draw.dart'; @@ -307,7 +308,9 @@ class _HomePageState extends State { Spacer(), AkuButton( //全部公告按钮 - onPressed: () {}, + onPressed: () { + Get.to(AllAnouncement()); + }, child: Row( children: [ Text( diff --git a/lib/ui/home/messages/system_message.dart b/lib/ui/home/messages/system_message.dart index 97cb992..5fede7a 100644 --- a/lib/ui/home/messages/system_message.dart +++ b/lib/ui/home/messages/system_message.dart @@ -17,9 +17,9 @@ class _SystemMessageState extends State { return Column( children: [ Container( - alignment: Alignment.center, + alignment: Alignment.topCenter, width: double.infinity, - height: 48.w + 33.w, + height: 24.w + 33.w, child: Text( date, style: TextStyle(color: AppStyle.minorTextColor, fontSize: 24.sp), @@ -157,7 +157,7 @@ class _SystemMessageState extends State { return AkuScaffold( title: '系统消息', body: ListView( - padding: EdgeInsets.all(32.w), + padding: EdgeInsets.only(top:24.w,left:32.w,right:32.w), children: [ _messageList('2020-10-23 10:00', '杨建', '17867665666', '共区'), _messageList('2020-10-22 10:00', '刘能', '17855823545', '共区'),