Commit b4accbf2ad0e76bb19571d4bde6f5189b5630967

Authored by weixin_45529955
1 parent 82e2dd1c

地图重新定位当前位置

... ... @@ -98,7 +98,7 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> {
// }
/// 获取定位权限
_requestLocationPermission() async {
_requestLocationPermission({bool forceCenter = false}) async {
await AmapLocation.instance.updatePrivacyShow(true);
await AmapLocation.instance.updatePrivacyAgree(true);
bool canLocation = false;
... ... @@ -128,7 +128,8 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> {
// App.sp.setString("lat", "39.684670899");
// App.sp.setString("lng", "118.17630045");
} else {
if (widget.long == null ||
if (forceCenter ||
widget.long == null ||
widget.long == '' ||
widget.long == 'null') {
latitude = location.latLng!.latitude;
... ... @@ -288,8 +289,7 @@ class _MapChoicePointPageState extends State<MapChoicePointPage> {
bottom: w(10),
child: InkWell(
onTap: () {
_controller!.setCenterCoordinate(
LatLng(latitudeLocation, longitudeLocation));
_requestLocationPermission(forceCenter: true);
},
child: Container(
decoration: BoxDecoration(
... ...