定位至当前坐标
parent
ab3b79c5aa
commit
1c9466b9b5
|
@ -97,7 +97,6 @@
|
|||
F71CB638C8651D72D3F3F2E8 /* Pods-RunnerTests.release.xcconfig */,
|
||||
74EC6693A0D90253C1EB11C6 /* Pods-RunnerTests.profile.xcconfig */,
|
||||
);
|
||||
name = Pods;
|
||||
path = Pods;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
|
@ -453,6 +452,7 @@
|
|||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
|
@ -463,6 +463,7 @@
|
|||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
|
@ -487,6 +488,7 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 5867QGN5CL;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
|
@ -574,6 +576,7 @@
|
|||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
|
@ -584,6 +587,7 @@
|
|||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
|
@ -629,6 +633,7 @@
|
|||
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
|
||||
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
|
||||
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
|
||||
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
|
||||
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
|
||||
CLANG_WARN_STRICT_PROTOTYPES = YES;
|
||||
CLANG_WARN_SUSPICIOUS_MOVE = YES;
|
||||
|
@ -639,6 +644,7 @@
|
|||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_USER_SCRIPT_SANDBOXING = NO;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_NO_COMMON_BLOCKS = YES;
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
|
@ -665,6 +671,7 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 5867QGN5CL;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
|
@ -687,6 +694,7 @@
|
|||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CURRENT_PROJECT_VERSION = "$(FLUTTER_BUILD_NUMBER)";
|
||||
DEVELOPMENT_TEAM = 5867QGN5CL;
|
||||
ENABLE_BITCODE = NO;
|
||||
INFOPLIST_FILE = Runner/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
ignoresPersistentStateOnLaunch = "NO"
|
||||
debugDocumentVersioning = "YES"
|
||||
debugServiceExtension = "internal"
|
||||
allowLocationSimulation = "YES">
|
||||
allowLocationSimulation = "NO">
|
||||
<BuildableProductRunnable
|
||||
runnableDebuggingMode = "0">
|
||||
<BuildableReference
|
||||
|
|
|
@ -17,7 +17,7 @@ class MapWidget extends StatefulWidget {
|
|||
}
|
||||
|
||||
class _MapWidgetState extends State<MapWidget> {
|
||||
late AMapController _mapController;
|
||||
AMapController? _mapController;
|
||||
Map<String, Object> _locationResult = {};
|
||||
late StreamSubscription<Map<String, Object>> _locationListener;
|
||||
final AMapFlutterLocation _locationPlugin = AMapFlutterLocation();
|
||||
|
@ -75,7 +75,8 @@ class _MapWidgetState extends State<MapWidget> {
|
|||
requestAccuracyAuthorization();
|
||||
}
|
||||
|
||||
_locationPlugin.setLocationOption(AMapLocationOption());
|
||||
var option = AMapLocationOption();
|
||||
_locationPlugin.setLocationOption(option);
|
||||
|
||||
///注册定位结果监听
|
||||
_locationListener = _locationPlugin
|
||||
|
@ -87,6 +88,10 @@ class _MapWidgetState extends State<MapWidget> {
|
|||
print("location=$_locationResult");
|
||||
});
|
||||
_locationPlugin.startLocation();
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
// 在页面渲染完成后执行代码
|
||||
// 例如,你可以在此处执行需要在页面加载完成后执行的操作
|
||||
});
|
||||
}
|
||||
|
||||
@override
|
||||
|
@ -108,7 +113,7 @@ class _MapWidgetState extends State<MapWidget> {
|
|||
_mapController = controller;
|
||||
getApprovalNumber();
|
||||
});
|
||||
_mapController.moveCamera(CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(29.52,121.31))));
|
||||
_moveCamera(_locationResult);
|
||||
},
|
||||
);
|
||||
return Expanded(
|
||||
|
@ -134,21 +139,24 @@ class _MapWidgetState extends State<MapWidget> {
|
|||
));
|
||||
}
|
||||
|
||||
void _moveCamera(Map<String,Object> result) {
|
||||
void _moveCamera(Map<String, Object> result) {
|
||||
double lat = double.parse(result['latitude'] as String);
|
||||
double lng = double.parse(result['longitude'] as String);
|
||||
_mapController.moveCamera(
|
||||
CameraUpdate.newCameraPosition(CameraPosition(target: LatLng(lat,lng))));
|
||||
if (_mapController != null) {
|
||||
_mapController!.moveCamera(CameraUpdate.newCameraPosition(
|
||||
CameraPosition(target: LatLng(lat, lng),zoom: 18)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
///获取审图号
|
||||
void getApprovalNumber() async {
|
||||
//普通地图审图号
|
||||
String? mapContentApprovalNumber =
|
||||
await _mapController.getMapContentApprovalNumber();
|
||||
await _mapController?.getMapContentApprovalNumber();
|
||||
//卫星地图审图号
|
||||
String? satelliteImageApprovalNumber =
|
||||
await _mapController.getSatelliteImageApprovalNumber();
|
||||
await _mapController?.getSatelliteImageApprovalNumber();
|
||||
print('地图审图号(普通地图): $mapContentApprovalNumber');
|
||||
print('地图审图号(卫星地图): $satelliteImageApprovalNumber');
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue