Open 553559555 opened 4 years ago
` void initState() { super.initState(); setState(() { this.isLoading = true; });
AMapLocationClient.startup(new AMapLocationOption( desiredAccuracy: CLLocationAccuracy.kCLLocationAccuracyHundredMeters)); getCurrentLocation();
} Future requestPermission() async { final permissions = await PermissionHandler() .requestPermissions([PermissionGroup.location]);
if (permissions[PermissionGroup.location] == PermissionStatus.granted) { return true; } else { CLToast.showToast('需要定位权限'); return false; }
}
Future getCurrentLocation() async { if (await requestPermission()) { AMapLocation loc = await AMapLocationClient.getLocation(true); log('123123123' + loc.latitude.toString() + loc.longitude.toString()); setState(() { this._location = loc; }); } }`
D/AmapLocationPugin( 4608): 定位获取结果:0.0 code:7 省: D/AmapLocationPugin( 4608): 定位获取结果:0.0 code:7 省:
` void initState() { super.initState(); setState(() { this.isLoading = true; });
} Future requestPermission() async {
final permissions = await PermissionHandler()
.requestPermissions([PermissionGroup.location]);
}
Future getCurrentLocation() async { if (await requestPermission()) { AMapLocation loc = await AMapLocationClient.getLocation(true); log('123123123' + loc.latitude.toString() + loc.longitude.toString()); setState(() { this._location = loc; }); } }`
D/AmapLocationPugin( 4608): 定位获取结果:0.0 code:7 省: D/AmapLocationPugin( 4608): 定位获取结果:0.0 code:7 省: