diff --git a/lib/pages/home/home_page.dart b/lib/pages/home/home_page.dart index 04de280..bbedac0 100644 --- a/lib/pages/home/home_page.dart +++ b/lib/pages/home/home_page.dart @@ -14,7 +14,7 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { bool enabled = false; - + late AMapController _mapController; @override Widget build(BuildContext context) { return Scaffold( @@ -223,19 +223,54 @@ class _HomePageState extends State { } Widget buildBottomWidget() { - const AMapWidget map = AMapWidget( + AMapWidget map = AMapWidget( ///必须正确设置的合规隐私声明,否则SDK不会工作,会造成地图白屏等问题。 privacyStatement: ConstConfig.amapPrivacyStatement, apiKey: ConstConfig.amapApiKeys, + mapType: MapType.navi, + scaleEnabled: false, + myLocationStyleOptions: MyLocationStyleOptions( + true, + circleFillColor: Colors.lightBlue, + circleStrokeColor: Colors.blue, + circleStrokeWidth: 1, + ), + onMapCreated: (AMapController controller){ + setState(() { + _mapController = controller; + getApprovalNumber(); + }); + }, ); return Expanded( - child: Container( - margin: const EdgeInsets.only(top: 10,bottom: 10), - decoration: const BoxDecoration( - color: Colors.white, - borderRadius: BorderRadius.all(Radius.circular(5))), - child: map, - ), + child: Stack( + children: [ + Container( + margin: const EdgeInsets.only(top: 10,bottom: 10), + decoration: const BoxDecoration( + color: Colors.white, + borderRadius: BorderRadius.all(Radius.circular(5))), + child: map, + ), + Positioned( + bottom: 20, + right: 20, + child: Image.asset("images/3.0x/current_location.png",width: 30,height: 30,), + ) + ], + ) ); } + + ///获取审图号 + void getApprovalNumber() async { + //普通地图审图号 + String? mapContentApprovalNumber = + await _mapController.getMapContentApprovalNumber(); + //卫星地图审图号 + String? satelliteImageApprovalNumber = + await _mapController.getSatelliteImageApprovalNumber(); + print('地图审图号(普通地图): $mapContentApprovalNumber'); + print('地图审图号(卫星地图): $satelliteImageApprovalNumber'); + } }