去掉搜索 和 定位
This commit is contained in:
@ -390,51 +390,51 @@ class _CreateMapScreenState extends State<CreateMapScreen>
|
||||
ListTile(
|
||||
title: Center(child: Text('根据朝向旋转定位图标')),
|
||||
onTap: () {
|
||||
AmapLocation.instance
|
||||
.listenLocation()
|
||||
.listen((it) =>
|
||||
_controller.setMyLocationRotateAngle(it.bearing!))
|
||||
.addTo(disposeBag);
|
||||
// AmapLocation.instance
|
||||
// .listenLocation()
|
||||
// .listen((it) =>
|
||||
// _controller.setMyLocationRotateAngle(it.bearing!))
|
||||
// .addTo(disposeBag);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
title: Center(child: Text('行程动画')),
|
||||
onTap: () async {
|
||||
final result = await AmapSearch.instance.searchDriveRoute(
|
||||
from: LatLng(39.958245, 116.330929),
|
||||
to: LatLng(39.915599, 116.42912),
|
||||
);
|
||||
final pathList = await result.drivePathList;
|
||||
final stepList = [
|
||||
for (final path in pathList) ...await path.driveStepList
|
||||
];
|
||||
final coordinateList = [
|
||||
for (final step in stepList) ...await step.polyline
|
||||
];
|
||||
await _controller.addPlaybackTrace(
|
||||
coordinateList,
|
||||
iconProvider: _assetsIcon,
|
||||
duration: Duration(
|
||||
milliseconds: coordinateList.length * 500,
|
||||
),
|
||||
);
|
||||
for (int i = 0; i < coordinateList.length; i++) {
|
||||
final last = coordinateList[max(i - 1, 0)];
|
||||
final current = coordinateList[i];
|
||||
await _controller.setCameraPosition(
|
||||
coordinate: coordinateList[i],
|
||||
zoom: 18,
|
||||
tilt: 45,
|
||||
bearing: bearing(
|
||||
last.latitude,
|
||||
last.longitude,
|
||||
current.latitude,
|
||||
current.longitude,
|
||||
) -
|
||||
105,
|
||||
);
|
||||
await Future.delayed(Duration(milliseconds: 500));
|
||||
}
|
||||
// final result = await AmapSearch.instance.searchDriveRoute(
|
||||
// from: LatLng(39.958245, 116.330929),
|
||||
// to: LatLng(39.915599, 116.42912),
|
||||
// );
|
||||
// final pathList = await result.drivePathList;
|
||||
// final stepList = [
|
||||
// for (final path in pathList) ...await path.driveStepList
|
||||
// ];
|
||||
// final coordinateList = [
|
||||
// for (final step in stepList) ...await step.polyline
|
||||
// ];
|
||||
// await _controller.addPlaybackTrace(
|
||||
// coordinateList,
|
||||
// iconProvider: _assetsIcon,
|
||||
// duration: Duration(
|
||||
// milliseconds: coordinateList.length * 500,
|
||||
// ),
|
||||
// );
|
||||
// for (int i = 0; i < coordinateList.length; i++) {
|
||||
// final last = coordinateList[max(i - 1, 0)];
|
||||
// final current = coordinateList[i];
|
||||
// await _controller.setCameraPosition(
|
||||
// coordinate: coordinateList[i],
|
||||
// zoom: 18,
|
||||
// tilt: 45,
|
||||
// bearing: bearing(
|
||||
// last.latitude,
|
||||
// last.longitude,
|
||||
// current.latitude,
|
||||
// current.longitude,
|
||||
// ) -
|
||||
// 105,
|
||||
// );
|
||||
// await Future.delayed(Duration(milliseconds: 500));
|
||||
// }
|
||||
},
|
||||
),
|
||||
],
|
||||
@ -483,15 +483,15 @@ class _SecondScreen extends StatelessWidget {
|
||||
Flexible(child: AmapView()),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
AmapLocation.instance.listenLocation().listen((event) {
|
||||
print(event);
|
||||
});
|
||||
// AmapLocation.instance.listenLocation().listen((event) {
|
||||
// print(event);
|
||||
// });
|
||||
},
|
||||
child: Text('开始定位'),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
AmapLocation.instance.stopLocation();
|
||||
// AmapLocation.instance.stopLocation();
|
||||
},
|
||||
child: Text('停止定位'),
|
||||
),
|
||||
|
Reference in New Issue
Block a user