【发布时间】:2020-05-23 04:43:01
【问题描述】:
我正在开发一个运输(资产)跟踪应用程序。并使用谷歌地图插件在谷歌地图中显示他们所有不同的资产。当用户单击资产的当前位置标记时,我想显示有关资产的信息。在 simpleton 中,我想将位置标记用作按钮。如果有任何其他方法可以实现这一点,请分享。
【问题讨论】:
标签: google-maps flutter dart flutter-layout
我正在开发一个运输(资产)跟踪应用程序。并使用谷歌地图插件在谷歌地图中显示他们所有不同的资产。当用户单击资产的当前位置标记时,我想显示有关资产的信息。在 simpleton 中,我想将位置标记用作按钮。如果有任何其他方法可以实现这一点,请分享。
【问题讨论】:
标签: google-maps flutter dart flutter-layout
必须有一些添加标记的代码,如下所示,只需添加onTap
markers.add(
Marker(
zIndex: 100,
markerId: MarkerId(myList[i].code),
position: LatLng(myList[i].latitude, myList[i].longitude),
icon: BitmapDescriptor.defaultMarkerWithHue(BitmapDescriptor.hueRed)
),
onTap: () {
//this is what you're looking for!
setState(() {
currCode=myList[i].code;
//call something here with myList[i].code or store in global constant for widget state
});
}
)
【讨论】: