Showing
1 changed file
with
4 additions
and
4 deletions
| @@ -98,7 +98,7 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | @@ -98,7 +98,7 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | ||
| 98 | // } | 98 | // } |
| 99 | 99 | ||
| 100 | /// 获取定位权限 | 100 | /// 获取定位权限 |
| 101 | - _requestLocationPermission() async { | 101 | + _requestLocationPermission({bool forceCenter = false}) async { |
| 102 | await AmapLocation.instance.updatePrivacyShow(true); | 102 | await AmapLocation.instance.updatePrivacyShow(true); |
| 103 | await AmapLocation.instance.updatePrivacyAgree(true); | 103 | await AmapLocation.instance.updatePrivacyAgree(true); |
| 104 | bool canLocation = false; | 104 | bool canLocation = false; |
| @@ -128,7 +128,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | @@ -128,7 +128,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | ||
| 128 | // App.sp.setString("lat", "39.684670899"); | 128 | // App.sp.setString("lat", "39.684670899"); |
| 129 | // App.sp.setString("lng", "118.17630045"); | 129 | // App.sp.setString("lng", "118.17630045"); |
| 130 | } else { | 130 | } else { |
| 131 | - if (widget.long == null || | 131 | + if (forceCenter || |
| 132 | + widget.long == null || | ||
| 132 | widget.long == '' || | 133 | widget.long == '' || |
| 133 | widget.long == 'null') { | 134 | widget.long == 'null') { |
| 134 | latitude = location.latLng!.latitude; | 135 | latitude = location.latLng!.latitude; |
| @@ -288,8 +289,7 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | @@ -288,8 +289,7 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> { | ||
| 288 | bottom: w(10), | 289 | bottom: w(10), |
| 289 | child: InkWell( | 290 | child: InkWell( |
| 290 | onTap: () { | 291 | onTap: () { |
| 291 | - _controller!.setCenterCoordinate( | ||
| 292 | - LatLng(latitudeLocation, longitudeLocation)); | 292 | + _requestLocationPermission(forceCenter: true); |
| 293 | }, | 293 | }, |
| 294 | child: Container( | 294 | child: Container( |
| 295 | decoration: BoxDecoration( | 295 | decoration: BoxDecoration( |
-
Please register or login to post a comment