From b4abbdbf71da4bcf7dc5596461c5a5c016058d68 Mon Sep 17 00:00:00 2001 From: laiiihz Date: Mon, 8 Feb 2021 14:45:47 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=9A=E5=A7=94=E4=BC=9A=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=A4=B4=E5=83=8F=E7=A7=BB=E9=99=A4=E4=BB=BB?= =?UTF-8?q?=E6=9C=9F=E6=97=B6=E9=97=B4=EF=BC=8C=E8=AF=9D=E9=A2=98=E5=8D=A1?= =?UTF-8?q?=E7=89=87=E6=B7=BB=E5=8A=A0=E4=B8=BE=E6=8A=A5=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/model/user/committee_item_model.dart | 52 ++++++++++++++----- .../industry_committee_page.dart | 39 ++++++++------ .../community_views/widgets/chat_card.dart | 25 ++++++++- 3 files changed, 86 insertions(+), 30 deletions(-) diff --git a/lib/model/user/committee_item_model.dart b/lib/model/user/committee_item_model.dart index ff48fba8..08e7f6e1 100644 --- a/lib/model/user/committee_item_model.dart +++ b/lib/model/user/committee_item_model.dart @@ -1,3 +1,5 @@ +import 'package:akuCommunity/model/common/img_model.dart'; + class CommitteeItemModel { int id; int positionId; @@ -10,6 +12,12 @@ class CommitteeItemModel { String roomNumber; int unitNo; int estateNo; + List imgUrls; + + String get firstImg { + if (imgUrls.isEmpty) return ''; + return imgUrls.first.url; + } String get sexValue { if (sexId == 0 || sexId == null) return '未设置'; @@ -18,18 +26,33 @@ class CommitteeItemModel { return '未设置'; } - CommitteeItemModel( - {this.id, - this.positionId, - this.name, - this.sexId, - this.age, - this.educationId, - this.roomName, - this.profession, - this.roomNumber, - this.unitNo, - this.estateNo}); + String get positionValue { + switch (positionId) { + case 1: + return '业委会主任'; + case 2: + return '业委会副主任'; + case 3: + return '业委会委员'; + default: + return ''; + } + } + + CommitteeItemModel({ + this.id, + this.positionId, + this.name, + this.sexId, + this.age, + this.educationId, + this.roomName, + this.profession, + this.roomNumber, + this.unitNo, + this.estateNo, + this.imgUrls, + }); CommitteeItemModel.fromJson(Map json) { id = json['id']; @@ -43,6 +66,11 @@ class CommitteeItemModel { roomNumber = json['roomNumber']; unitNo = json['unitNo']; estateNo = json['estateNo']; + if (json['imgUrls'] != null) { + imgUrls = + (json['imgUrls'] as List).map((e) => ImgModel.fromJson(e)).toList(); + } else + imgUrls = []; } Map toJson() { diff --git a/lib/pages/industry_committee/industry_committee_page.dart b/lib/pages/industry_committee/industry_committee_page.dart index 5ac34766..7df90d5f 100644 --- a/lib/pages/industry_committee/industry_committee_page.dart +++ b/lib/pages/industry_committee/industry_committee_page.dart @@ -60,19 +60,19 @@ class _IndustryCommitteePageState extends State { )) .make() .expand(), - MaterialButton( - onPressed: CommitteeMailboxPage().to, - height: 98.w, - color: kPrimaryColor, - child: '业委会信箱'.text.size(32.sp).color(ktextPrimary).make(), - ) - .box - .color(kPrimaryColor) - .padding(EdgeInsets.only( - bottom: MediaQuery.of(context).viewPadding.bottom, - )) - .make() - .expand(), + // MaterialButton( + // onPressed: CommitteeMailboxPage().to, + // height: 98.w, + // color: kPrimaryColor, + // child: '业委会信箱'.text.size(32.sp).color(ktextPrimary).make(), + // ) + // .box + // .color(kPrimaryColor) + // .padding(EdgeInsets.only( + // bottom: MediaQuery.of(context).viewPadding.bottom, + // )) + // .make() + // .expand(), ].row(); } @@ -83,10 +83,12 @@ class _IndustryCommitteePageState extends State { children: [ ClipRRect( borderRadius: BorderRadius.circular(4.w), - child: SizedBox( + child: FadeInImage.assetNetwork( + placeholder: R.ASSETS_IMAGES_PLACEHOLDER_WEBP, + image: API.image(model.firstImg), height: 150.w, width: 150.w, - child: Placeholder(), + fit: BoxFit.cover, ), ), 24.wb, @@ -100,7 +102,10 @@ class _IndustryCommitteePageState extends State { height: 44.w, padding: EdgeInsets.symmetric(horizontal: 22.w, vertical: 6.w), - child: 'XXX'.text.size(24.sp).color(ktextPrimary).make(), + child: model.positionValue.text + .size(24.sp) + .color(ktextPrimary) + .make(), decoration: BoxDecoration( color: Color(0xFFFFF3CD), borderRadius: BorderRadius.circular(22.w), @@ -115,7 +120,7 @@ class _IndustryCommitteePageState extends State { .size(24.sp) .color(ktextSubColor) .make(), - '任职期限:XXXXX'.text.size(24.sp).color(ktextSubColor).make(), + // '任职期限:XXXXX'.text.size(24.sp).color(ktextSubColor).make(), '从事岗位:${model.profession}' .text .size(24.sp) diff --git a/lib/ui/community/community_views/widgets/chat_card.dart b/lib/ui/community/community_views/widgets/chat_card.dart index a1dea5aa..ca4fa282 100644 --- a/lib/ui/community/community_views/widgets/chat_card.dart +++ b/lib/ui/community/community_views/widgets/chat_card.dart @@ -293,7 +293,30 @@ class _ChatCardState extends State { Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - widget.model.createName.text.black.size(36.sp).make(), + [ + widget.model.createName.text.black + .size(36.sp) + .make() + .expand(), + PopupMenuButton( + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(8.w)), + itemBuilder: (context) { + return [ + PopupMenuItem( + child: '举报'.text.isIntrinsic.make(), + value: 0, + ), + ]; + }, + onSelected: (_) async { + VoidCallback cancel = BotToast.showLoading(); + await Future.delayed(Duration(milliseconds: 1000)); + cancel(); + BotToast.showText(text: '举报成功'); + }, + ), + ].row(), 6.hb, widget.model.content.text.black.make(), 20.hb,