From 3a15265753c1138b2b94c24b29e71e2d771dc7a4 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 18 May 2021 11:47:31 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20=E7=A4=BE=E5=8C=BA?= =?UTF-8?q?=E4=BB=8B=E7=BB=8D=20=E6=B7=BB=E5=8A=A0=20=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=20=E6=B7=BB=E5=8A=A0=20=E5=85=AC=E5=85=B1?= =?UTF-8?q?=E8=B5=84=E8=AE=AF=E8=AF=A6=E6=83=85=20=E5=AF=B9=E6=8E=A5=20?= =?UTF-8?q?=E5=85=AC=E5=85=B1=E8=B5=84=E8=AE=AF=E8=AF=A6=E6=83=85=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/constants/api.dart | 3 + lib/constants/application_objects.dart | 27 +++-- lib/models/news/news_detail_model.dart | 37 +++++++ lib/models/news/news_detail_model.g.dart | 19 ++++ .../community_introduce_page.dart | 45 ++++++++ .../service_browse/service_browse_page.dart | 70 ++++++++++++ .../public_infomation_card.dart | 7 +- .../public_information_detail_page.dart | 100 ++++++++++++++++++ 8 files changed, 300 insertions(+), 8 deletions(-) create mode 100644 lib/models/news/news_detail_model.dart create mode 100644 lib/models/news/news_detail_model.g.dart create mode 100644 lib/pages/community_introduce/community_introduce_page.dart create mode 100644 lib/pages/service_browse/service_browse_page.dart create mode 100644 lib/ui/home/public_infomation/public_information_detail_page.dart diff --git a/lib/constants/api.dart b/lib/constants/api.dart index fbb2c97d..0e13929a 100644 --- a/lib/constants/api.dart +++ b/lib/constants/api.dart @@ -221,6 +221,9 @@ class _Manager { ///app 包裹代收:确认领取 String get packageConfirm => '/user/packageCollection/confirmCollection'; + + ///app公共资讯:根据资讯主键id 查询资讯信息详情 + String get getPublicInformationDetail => '/user/news/findNewsByNewsId'; } class _Community { diff --git a/lib/constants/application_objects.dart b/lib/constants/application_objects.dart index 280a99a8..244a7c5b 100644 --- a/lib/constants/application_objects.dart +++ b/lib/constants/application_objects.dart @@ -1,13 +1,11 @@ // import 'package:aku_community/widget/bee_scaffold.dart'; -import 'package:aku_community/pages/electronic_commerc/electronic_commerc_page.dart'; -import 'package:aku_community/pages/renovation_manage/renovation_manage_page.dart'; import 'package:flutter/material.dart'; -import 'package:equatable/equatable.dart'; - import 'package:aku_community/const/resource.dart'; +import 'package:aku_community/pages/community_introduce/community_introduce_page.dart'; import 'package:aku_community/pages/convenient_phone/convenient_phone_page.dart'; +import 'package:aku_community/pages/electronic_commerc/electronic_commerc_page.dart'; import 'package:aku_community/pages/event_activity/event_voting_page.dart'; import 'package:aku_community/pages/express_packages/express_package_page.dart'; import 'package:aku_community/pages/goods_deto_page/goods_deto_page.dart'; @@ -16,6 +14,8 @@ import 'package:aku_community/pages/industry_committee/industry_committee_page.d import 'package:aku_community/pages/life_pay/life_pay_page.dart'; import 'package:aku_community/pages/one_alarm/widget/alarm_page.dart'; import 'package:aku_community/pages/opening_code_page/opening_code_page.dart'; +import 'package:aku_community/pages/renovation_manage/renovation_manage_page.dart'; +import 'package:aku_community/pages/service_browse/service_browse_page.dart'; import 'package:aku_community/pages/setting_page/settings_page.dart'; import 'package:aku_community/pages/things_page/fixed_submit_page.dart'; import 'package:aku_community/pages/visitor_access_page/visitor_access_page.dart'; @@ -30,7 +30,7 @@ import 'package:aku_community/ui/profile/house/house_owners_page.dart'; ///应用对象 ///Application Object -class AO extends Equatable { +class AO { String title = ''; String path = ''; dynamic page = () => Scaffold(); @@ -52,7 +52,16 @@ class AO extends Equatable { } @override - List get props => [title]; + bool operator ==(Object other) { + if (identical(this, other)) return true; + + return other is AO && + other.title == title && + other.path == path; + } + + @override + int get hashCode => title.hashCode ^ path.hashCode; } ///所有应用 @@ -79,7 +88,9 @@ List appObjects = [ AO('一键报警', R.ASSETS_APPLICATIONS_POLICE_PNG, () => AlarmPage()), AO('设施预约', R.ASSETS_ICONS_TOOL_FACILITY_PNG, () => FacilityAppointmentPage()), AO('快递包裹', R.ASSETS_APPLICATIONS_TRANSFER_PNG, () => ExpressPackagePage()), - AO('电子商务', R.ASSETS_IMAGES_PLACEHOLDER_WEBP, () => ElectronicCommercPage()), + AO('电子商务', R.ASSETS_IMAGES_PLACEHOLDER_WEBP, () => ElectronicCommercPage()), + AO('服务浏览', R.ASSETS_IMAGES_PLACEHOLDER_WEBP, () => ServiceBrowsePage()), + AO('社区介绍', R.ASSETS_IMAGES_PLACEHOLDER_WEBP, () => CommunityIntroducePage()), // AO( // '小区教育', // R.ASSETS_IMAGES_PLACEHOLDER_WEBP, @@ -156,6 +167,8 @@ List _smartManagerApp = [ '设施预约', '快递包裹', '电子商务', + '服务浏览', + '社区介绍', // '小区教育', // '健康运动', // '家政服务', diff --git a/lib/models/news/news_detail_model.dart b/lib/models/news/news_detail_model.dart new file mode 100644 index 00000000..0750610b --- /dev/null +++ b/lib/models/news/news_detail_model.dart @@ -0,0 +1,37 @@ +import 'package:equatable/equatable.dart'; +import 'package:json_annotation/json_annotation.dart'; +part 'news_detail_model.g.dart'; + +@JsonSerializable() +class NewsDetailModel extends Equatable { + final int id; + final String code; + final String title; + final String content; + final String newsCategoryName; + final String createName; + final String createDate; + NewsDetailModel({ + required this.id, + required this.code, + required this.title, + required this.content, + required this.newsCategoryName, + required this.createName, + required this.createDate, + }); + factory NewsDetailModel.fromJson(Map json) => + _$NewsDetailModelFromJson(json); + @override + List get props { + return [ + id, + code, + title, + content, + newsCategoryName, + createName, + createDate, + ]; + } +} diff --git a/lib/models/news/news_detail_model.g.dart b/lib/models/news/news_detail_model.g.dart new file mode 100644 index 00000000..3f9844b5 --- /dev/null +++ b/lib/models/news/news_detail_model.g.dart @@ -0,0 +1,19 @@ +// GENERATED CODE - DO NOT MODIFY BY HAND + +part of 'news_detail_model.dart'; + +// ************************************************************************** +// JsonSerializableGenerator +// ************************************************************************** + +NewsDetailModel _$NewsDetailModelFromJson(Map json) { + return NewsDetailModel( + id: json['id'] as int, + code: json['code'] as String, + title: json['title'] as String, + content: json['content'] as String, + newsCategoryName: json['newsCategoryName'] as String, + createName: json['createName'] as String, + createDate: json['createDate'] as String, + ); +} diff --git a/lib/pages/community_introduce/community_introduce_page.dart b/lib/pages/community_introduce/community_introduce_page.dart new file mode 100644 index 00000000..735dfbd1 --- /dev/null +++ b/lib/pages/community_introduce/community_introduce_page.dart @@ -0,0 +1,45 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:flutter/material.dart'; +import 'package:aku_community/const/resource.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; + +class CommunityIntroducePage extends StatefulWidget { + CommunityIntroducePage({Key? key}) : super(key: key); + + @override + _CommunityIntroducePageState createState() => _CommunityIntroducePageState(); +} + +class _CommunityIntroducePageState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + bodyColor: Colors.white, + title: '社区介绍', + body: ListView( + children: [ + SizedBox( + child: Image.asset( + R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + fit: BoxFit.cover, + ), + width: double.infinity, + height: 424.w, + ), + 24.w.heightBox, + ''' 小区内部环境典雅幽静,绿化多,通过小区道路的合理组织,休闲设施的精心安排,提供自然、舒适的居住环境。周边配套齐全,设施完备,物业管理完善,保安24小时值班,住户素质高。社区主流健康向上,社区风气良好,邻里关系和谐。 + 基础设施健全,周围商圈多,购物,就医,娱乐等方便快捷。为一个集生态环境、人文环境、信息化和管理控制自动化等优质服务为一体的高档个性化住宅小区。 + 环境优美,丽水成天的风景给予了回归家庭、回归私域的生活体验。房屋楼层分布均匀,室内装修豪华气派,视眼非常宽广,采光较好。 + 坐北朝南,整体体现现代简约风格,建筑设计线条明朗,色彩大气简约,采用中间高、东西低的建筑高度,使小区建筑形态层次分明,富有强烈韵律感。 + 居于此,拥城市繁华、享离尘静谧,自由掌控生活,占核心享未来 。''' + .text + .size(28.sp) + .color(ktextPrimary) + .make(), + ], + ), + ); + } +} diff --git a/lib/pages/service_browse/service_browse_page.dart b/lib/pages/service_browse/service_browse_page.dart new file mode 100644 index 00000000..457d0cbc --- /dev/null +++ b/lib/pages/service_browse/service_browse_page.dart @@ -0,0 +1,70 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:aku_community/extensions/widget_list_ext.dart'; + +class ServiceBrowsePage extends StatefulWidget { + ServiceBrowsePage({Key? key}) : super(key: key); + + @override + _ServiceBrowsePageState createState() => _ServiceBrowsePageState(); +} + +class _ServiceBrowsePageState extends State { + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '服务浏览', + body: ListView( + padding: EdgeInsets.symmetric(vertical: 12.w), + children: [ + _buildCard( + '小区绿化服务范围及工作范畴', + '随着城市建设的发展,人们对生活环境的要求越来越高,越来越重视小区的园林绿化建设,绿化养护作为一项长期性工作,需要有科学的计划和正确的实施方法,同时要求园林人扎实做好......', + '南宁人才公寓', + ' 04-13 09:46'), + ].sepWidget(separate: 12.w.heightBox), + ), + ); + } + + Widget _buildCard(String title, String content, String name, String date) { + return Container( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + width: double.infinity, + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + title.text + .size(32.sp) + .color(ktextPrimary) + .maxLines(1) + .overflow(TextOverflow.ellipsis) + .bold + .make(), + 32.w.heightBox, + content.text + .size(24.sp) + .color(ktextSubColor) + .maxLines(3) + .overflow(TextOverflow.ellipsis) + .make(), + 32.w.heightBox, + Row( + children: [ + name.text.size(20.sp).color(ktextSubColor).make(), + Spacer(), + '发布于 ${DateUtil.formatDateStr(date, format: 'MM-dd HH:mm')}' + .text + .size(20.sp) + .color(ktextSubColor) + .make(), + ], + ), + ], + )); + } +} diff --git a/lib/ui/home/public_infomation/public_infomation_card.dart b/lib/ui/home/public_infomation/public_infomation_card.dart index d6b415c4..9364d91e 100644 --- a/lib/ui/home/public_infomation/public_infomation_card.dart +++ b/lib/ui/home/public_infomation/public_infomation_card.dart @@ -1,11 +1,13 @@ import 'package:aku_community/constants/api.dart'; import 'package:aku_community/model/common/img_model.dart'; import 'package:aku_community/models/news/news_item_model.dart'; +import 'package:aku_community/ui/home/public_infomation/public_information_detail_page.dart'; import 'package:flustars/flustars.dart'; import 'package:flutter/material.dart'; import 'package:aku_community/base/base_style.dart'; import 'package:aku_community/utils/headers.dart'; +import 'package:get/get.dart'; class PublicInfomationCard extends StatelessWidget { final NewsItemModel model; @@ -17,7 +19,9 @@ class PublicInfomationCard extends StatelessWidget { color: Colors.white, elevation: 0, materialTapTargetSize: MaterialTapTargetSize.shrinkWrap, - onPressed: () {}, + onPressed: () { + Get.to(() => PublicInformationDetailPage(id:this.model.id)); + }, padding: EdgeInsets.zero, child: Container( height: 248.w, @@ -26,6 +30,7 @@ class PublicInfomationCard extends StatelessWidget { children: [ Expanded( child: Column( + crossAxisAlignment: CrossAxisAlignment.start, children: [ Text(model.title), Spacer(), diff --git a/lib/ui/home/public_infomation/public_information_detail_page.dart b/lib/ui/home/public_infomation/public_information_detail_page.dart new file mode 100644 index 00000000..56c3e2f7 --- /dev/null +++ b/lib/ui/home/public_infomation/public_information_detail_page.dart @@ -0,0 +1,100 @@ +import 'package:aku_community/base/base_style.dart'; +import 'package:aku_community/constants/api.dart'; +import 'package:aku_community/models/news/news_detail_model.dart'; +import 'package:aku_community/utils/network/base_model.dart'; +import 'package:aku_community/utils/network/net_util.dart'; +import 'package:aku_community/widget/bee_scaffold.dart'; +import 'package:bot_toast/bot_toast.dart'; +import 'package:flustars/flustars.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter_easyrefresh/easy_refresh.dart'; +import 'package:velocity_x/velocity_x.dart'; +import 'package:flutter_screenutil/flutter_screenutil.dart'; + +class PublicInformationDetailPage extends StatefulWidget { + final int id; + PublicInformationDetailPage({Key? key, required this.id}) : super(key: key); + + @override + _PublicInformationDetailPageState createState() => + _PublicInformationDetailPageState(); +} + +class _PublicInformationDetailPageState + extends State { + late EasyRefreshController _easyRefreshController; + bool _onload = true; + late NewsDetailModel _detailModel; + @override + void initState() { + super.initState(); + _easyRefreshController = EasyRefreshController(); + } + + @override + void dispose() { + _easyRefreshController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return BeeScaffold( + title: '公共资讯', + bodyColor: Colors.white, + body: EasyRefresh( + firstRefresh: true, + header: MaterialHeader(), + onRefresh: () async { + BaseModel baseModel = await NetUtil() + .get(API.manager.getPublicInformationDetail, params: { + "newsId": widget.id, + }); + if (baseModel.status! && baseModel.data != null) { + _detailModel = NewsDetailModel.fromJson(baseModel.data); + } else { + BotToast.showText(text: '无法获取信息'); + } + _onload = false; + setState(() {}); + }, + child: _onload + ? _emptyWidget() + : ListView( + padding: EdgeInsets.symmetric(vertical: 24.w, horizontal: 32.w), + children: [ + _detailModel.title.text + .size(36.sp) + .color(ktextPrimary) + .bold + .align(TextAlign.center) + .make(), + 24.w.heightBox, + SizedBox( + width: double.infinity, + child: _detailModel.content.text + .size(28.sp) + .color(ktextPrimary) + .make(), + ), + 40.w.heightBox, + Row( + children: [ + Spacer(), + '发布于 ${DateUtil.formatDateStr(_detailModel.createDate, format: 'MM-dd HH:mm')}' + .text + .size(24.sp) + .color(ktextSubColor) + .make(), + ], + ) + ], + ), + ), + ); + } + + Widget _emptyWidget() { + return Container(); + } +}