gpt4 book ai didi

google-maps - 使用 Flutter Google Maps 插件自定义标记

转载 作者:IT老高 更新时间:2023-10-28 12:35:32 25 4
gpt4 key购买 nike

官方有没有办法显示自定义标记Flutter Google Maps plugin在 map 上?根据文档找不到任何方法。

最佳答案

BitmapDescriptor customIcon;

// make sure to initialize before map loading
BitmapDescriptor.fromAssetImage(ImageConfiguration(size: Size(12, 12)),
'assets/images/car-icon.png')
.then((d) {
customIcon = d;
});

final nearbyCarsLocation = [
LatLng(24.9286825, 67.0403249),
LatLng(24.985577, 67.0661056), //24.9294892,67.0391903,18.73z
];

void _getNearByCars() {

for (var i = 0; i < nearbyCarsLocation.length; i++) {
var now = new DateTime.now().millisecondsSinceEpoch;
_markers.add(Marker(
markerId: MarkerId(nearbyCarsLocation[i].toString() + now.toString()),
position: nearbyCarsLocation[i],
// infoWindow: InfoWindow(title: address, snippet: "go here"),
icon: customIcon ));
}
notifyListeners();
}

希望这将有助于获得自定义附近的地区

关于google-maps - 使用 Flutter Google Maps 插件自定义标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52591556/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com