From 8b6a407d9542e7aed225b2e9eec036207c580aed Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Tue, 13 Apr 2021 14:34:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E7=82=B9=E8=AF=A6=E6=83=85=E8=BF=9B=E5=85=A5=E7=99=BD=E5=B1=8F?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/models/common/img_model.dart | 6 ++++++ .../inspection/inspection_check_detail_model.dart | 14 ++++++++------ .../inspection_manage_details_page.dart | 1 + .../inspection_point_detail_page.dart | 15 ++++++++++++--- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/lib/models/common/img_model.dart b/lib/models/common/img_model.dart index e8a9dd2..6131ea1 100644 --- a/lib/models/common/img_model.dart +++ b/lib/models/common/img_model.dart @@ -7,6 +7,12 @@ class ImgModel { ImgModel({this.url, this.size, this.longs, this.paragraph, this.sort}); + static String first(List models) { + if (models == null) return ''; + if (models.isEmpty) return ''; + return models.first.url; + } + ImgModel.fromJson(Map json) { url = json['url']; size = json['size']; diff --git a/lib/models/manager/inspection/inspection_check_detail_model.dart b/lib/models/manager/inspection/inspection_check_detail_model.dart index a9b0ebc..9c170a4 100644 --- a/lib/models/manager/inspection/inspection_check_detail_model.dart +++ b/lib/models/manager/inspection/inspection_check_detail_model.dart @@ -1,3 +1,5 @@ +import 'package:aku_community_manager/models/common/img_model.dart'; + class InspectionCheckDetialModel { int id; int executeId; @@ -6,8 +8,8 @@ class InspectionCheckDetialModel { int type; String completeDate; List checkFBIVoList; - List faceImg; - List spaceImg; + List faceImg; + List spaceImg; InspectionCheckDetialModel( {this.id, @@ -34,15 +36,15 @@ class InspectionCheckDetialModel { }); } if (json['faceImg'] != null) { - faceImg = new List(); + faceImg = new List(); json['faceImg'].forEach((v) { - faceImg.add(new FaceImg.fromJson(v)); + faceImg.add(new ImgModel.fromJson(v)); }); } if (json['spaceImg'] != null) { - spaceImg = new List(); + spaceImg = new List(); json['spaceImg'].forEach((v) { - spaceImg.add(new FaceImg.fromJson(v)); + spaceImg.add(new ImgModel.fromJson(v)); }); } } diff --git a/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart index b9efe33..37e1119 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_manage_details_page.dart @@ -415,6 +415,7 @@ class _InspectionManageDetailsPageState hasScan: model.completeDate == null ? false : true, executePointId: model.id, executeName: _detailModel.name, + status: _detailModel.status, )); }); } diff --git a/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart b/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart index 68907a8..0b3a38e 100644 --- a/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart +++ b/lib/ui/manage_pages/inspection_manage/inspection_point_detail_page.dart @@ -1,4 +1,5 @@ import 'package:aku_community_manager/const/api.dart'; +import 'package:aku_community_manager/models/common/img_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_check_detail_model.dart'; import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_utils.dart'; @@ -15,12 +16,14 @@ import 'package:velocity_x/velocity_x.dart'; class InspectionPointDetailPage extends StatefulWidget { final int executePointId; final String executeName; - final hasScan; + final bool hasScan; + final int status; InspectionPointDetailPage({ Key key, this.executePointId, this.executeName, @required this.hasScan, + this.status, }) : super(key: key); @override @@ -109,7 +112,7 @@ class _InspectionPointDetailPageState extends State { child: FadeInImage.assetNetwork( fit: BoxFit.fill, placeholder: R.ASSETS_PLACEHOLDER_WEBP, - image: API.image(_detialModel.faceImg?.first?.url ?? '')), + image: API.image(ImgModel.first(_detialModel.faceImg))), ) : DottedBorder( borderType: BorderType.RRect, @@ -161,7 +164,7 @@ class _InspectionPointDetailPageState extends State { child: FadeInImage.assetNetwork( fit: BoxFit.fill, placeholder: R.ASSETS_PLACEHOLDER_WEBP, - image: API.image(_detialModel.spaceImg?.first?.url ?? '')), + image: API.image(ImgModel.first(_detialModel.spaceImg))), ) : DottedBorder( borderType: BorderType.RRect, @@ -330,6 +333,12 @@ class _InspectionPointDetailPageState extends State { fontSize: 36.sp, fontWeight: FontWeight.bold), ), + Spacer(), + InspectionUtils.status[widget.status].text + .color(InspectionUtils.color(widget.status)) + .bold + .size(28.sp) + .make() ], ), ),