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() ], ), ),