From 9084987b2b7ed6b00b933dd4267500c28cdde1b7 Mon Sep 17 00:00:00 2001 From: zhangmeng <494089941@qq.com> Date: Thu, 6 May 2021 17:13:07 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A1=E6=9B=B4=E8=B7=AF=E7=BA=BF=E5=9B=BE?= =?UTF-8?q?=E7=BB=98=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../inspection_manage_details_page.dart | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) 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 43cff1f..0351643 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 @@ -77,6 +77,7 @@ class _InspectionManageDetailsPageState EasyRefreshController _refreshController; bool _exit = false; List _points = []; + List _polylines = []; @override void initState() { super.initState(); @@ -223,6 +224,7 @@ class _InspectionManageDetailsPageState CupertinoDialogAction( child: '取消'.text.size(28.sp).black.light.isIntrinsic.bold.make(), onPressed: () { + _exit = false; Get.back(); }, ) @@ -268,8 +270,11 @@ class _InspectionManageDetailsPageState } _stopTimer() { + _canUploadLocation = false; _timer?.cancel(); _timer = null; + _points.clear(); + _polylines.clear(); } Widget _inspectionHeadCard() { @@ -523,9 +528,31 @@ class _InspectionManageDetailsPageState } else { _canUploadLocation = false; //TODO:绘制折线 + _points.add(argument.latLng); + if (_points.length % 5 == 0) { + if (_polylines.isEmpty) { + _polylines.add(Polyline( + points: _points, + color: Colors.red, + width: 10.w, + )); + setState(() { + + }); + } else { + _polylines[0] = (Polyline( + points: _points, + color: Colors.red, + width: 10.w, + )); + setState(() {}); + } + } } } }, + //绘制路线 + polylines: Set.of(_polylines), ), ), ], @@ -537,6 +564,17 @@ class _InspectionManageDetailsPageState .make(); } + void _creatPolyline() { + final Polyline _polyline = Polyline( + points: _points, + color: Colors.red, + width: 5.w, + ); + setState(() { + _polylines.add(_polyline); + }); + } + Future _uploadLocation( int executeId, double longitude, double latitude) async { BaseModel baseModel = await NetUtil().post(API.manage.uploadLocation,