import 'package:flutter/material.dart';
import 'package:amap_flutter_map/amap_flutter_map.dart';
import 'package:amap_flutter_base/amap_flutter_base.dart';
class RunPage extends StatefulWidget {
RunPage({Key key}) : super(key: key);
@override
_RunPageState createState() => _RunPageState();
}
class _RunPageState extends State<RunPage> {
List<Widget> _approvalNumberWidget = <Widget>[];
static const AMapApiKey amapApiKeys = AMapApiKey(
androidKey: 'f80b827969ecf361f33aee48accfa025',
iosKey: '96be023e56b7ff4f1bc0cd67ac8f5a83');
@override
Widget build(BuildContext context) {
final AMapWidget map = AMapWidget(
mapType: MapType.satellite,
apiKey: amapApiKeys,
onMapCreated: onMapCreated,
zoomGesturesEnabled: true,
myLocationStyleOptions: MyLocationStyleOptions(
true,
circleFillColor: Colors.lightBlue,
circleStrokeColor: Colors.blue,
circleStrokeWidth: 1,
),
);
return Scaffold(
body: ConstrainedBox(
constraints: BoxConstraints.expand(),
child: Stack(
alignment: Alignment.center,
children: [
GestureDetector(
child: Container(
// height: MediaQuery.of(context).size.height,
// width: MediaQuery.of(context).size.width,
child: map,
),
onScaleUpdate: (ScaleUpdateDetails details) {
print('查看缩放数值:');
print(details.scale);
print(details.horizontalScale);
print(details.verticalScale);
},
),
],
),
),
);
}
AMapController _mapController;
void onMapCreated(AMapController controller) {
setState(() {
_mapController = controller;
getApprovalNumber();
});
}
/// 获取审图号
void getApprovalNumber() async {
//普通地图审图号
String mapContentApprovalNumber =
(await _mapController.getMapContentApprovalNumber());
//卫星地图审图号
String satelliteImageApprovalNumber =
(await _mapController.getSatelliteImageApprovalNumber());
setState(() {
_approvalNumberWidget.add(Text(mapContentApprovalNumber));
_approvalNumberWidget.add(Text(satelliteImageApprovalNumber));
});
print('地图审图号(普通地图): $mapContentApprovalNumber');
print('地图审图号(卫星地图): $satelliteImageApprovalNumber');
}
}
一个小缺陷
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
- 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
- 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
- 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...