一个扩展 Google 地图的 Flutter 包,允许开发者在地图上放置基于自定义 widget 的标记。与标准标记不同,该包支持使用任何 Flutter widget(如图标、头像或交互式元素)作为地图标记。它可无缝集成到 Google 地图插件中,并支持 Android、iOS 和 Web 平台。适用于需要丰富、动态或交互式标记内容的应用程序,超越简单的图像或文本。
You need to insert the list of WidgetMarker to use widget markers.
Make sure that you still need to use onTap method when you use gestures.
class WidgetMarker {
WidgetMarker({
required this.position,
required this.markerId,
required this.widget,
this.onTap,
}) : assert(markerId.isNotEmpty);
final LatLng position;
/// Keep this unique, otherwise it will not appear.
final String markerId;
/// Gestures of widget is disabled.
/// Use this callback instead.
final VoidCallback? onTap;
final Widget widget;
}
If you have any requests or questions, feel free to ask on github.
Contributors ✨
Thanks goes to these wonderful people (emoji key):