- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
使用 Google Maps for Flutter我在 map 上的不同位置放置了一些标记。我的 Flutter 应用程序上有一个单独的 RaisedButton,只有当这些标记中的一个或多个当前在 map 上可见时,我才需要它可见。
如何实现?我发现有点 similar solution用于 Google Maps API,但我需要它用于 Flutter 上的 google_maps_flutter。
最佳答案
LatLngBounds
具有称为 contains()
的特定方法,它与 GoogleMapController
的 getVisibleRegion()
一起工作.
来自官方文档:
contains(LatLng point) → bool
Returns whether this rectangle contains the given LatLng.
Completer<GoogleMapController> _controller = Completer();
static final CameraPosition _positionCenter = CameraPosition(
target: LatLng(40.730610, -73.935242),
zoom: 3.5,
);
Future<LatLngBounds> _getVisibleRegion() async {
final GoogleMapController controller = await _controller.future;
final LatLngBounds bounds = await controller.getVisibleRegion();
return bounds;
}
@override
Widget build(BuildContext context) {
void checkMarkers() async {
LatLngBounds bounds = await _getVisibleRegion();
Set<Marker> markers = Set<Marker>.of(markers.values);
markers.forEach((marker) {
print('Position: ${ marker.position } - Contains: ${ bounds.contains(marker.position) }');
});
}
return GoogleMap(
mapType: MapType.normal,
markers: Set<Marker>.of(markers.values),
initialCameraPosition: _positionCenter,
onCameraIdle: () {
checkMarkers();
},
onMapCreated: (GoogleMapController controller) async {
_controller.complete(controller);
checkMarkers();
},
);
}
关于google-maps - 在 google_maps_flutter 中获取可见标记,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54107587/
我正在尝试开发一种用户体验,向用户提供要前往的地点列表,并在选择这些地点之一后,我希望它 向 map 添加标记 显示信息窗口 提供导航到 地点。 我能够使用信息from this PR (似乎没有官方
我正在尝试存档我的 flutter 应用程序以将其发布到 App Store Connect。然后我遇到了这个问题,我尝试了互联网上的每一个解决方案,但似乎没有任何效果,所以我需要帮助。 问题是: 最
如何在谷歌地图上实现一个标记,标记上的文本会 flutter 。图片供引用: /image/W6oqG.jpg 最佳答案 我用这个方法解决了 Future createCustomMarkerBitm
我想在 google_maps_flutter 中显示脉冲动画标记. 有没有办法在 Flutter 中做这样的(下面)标记? 我可以这样做(如下): For easy to understand wh
我正在开发一个应用程序,并且想要显示没有街道名称的 map 。 有什么方法可以禁用街道名称吗? 最佳答案 适用于 flutter 的 Google map 现在能够自定义 map 样式。前往Googl
我正在尝试集成google_maps_flutter到现有项目中。 map 组件仅在设备上直接运行“my_flutter”项目时才起作用(相同的代码)。 当我尝试从现有应用程序运行 flutter 模
使用 java,我们可以通过使用瓦片覆盖将 WMS 瓦片放在 Google Base Map 的顶部。在 flutter 中,我发现 google_maps_flutter 在其构造函数上有 tile
我正在开发一个使用 google_maps_flutter 的应用程序插件(版本 0.5.7)来显示 map 。直到昨天它工作得很好。我没有对我的应用程序进行任何更新,它只是在我今天打开它时停止显示空
使用 Google Maps for Flutter我在 map 上的不同位置放置了一些标记。我的 Flutter 应用程序上有一个单独的 RaisedButton,只有当这些标记中的一个或多个当前在
我已经添加了 Google Maps for Flutter我知道如何添加标记,因为它在示例中清楚地给出了 MarkerOptions _options = new MarkerOptions(
我在我的 flutter 项目中使用 google_maps_flutter 库,我创建了一个多边形,但我想检查一个坐标是否在多边形内......我该怎么做? 那是谷歌小部件 GoogleMap(
我正在尝试使用 flutter 在 map View 中显示当前用户位置。在iOS中,很简单,只需添加self.mapView.showsUserLocation = YES;这将在 map View
我正在我的 flutter 应用程序中实现 google_maps_flutter 插件,并坚持使用红色突出显示国家,例如印度,蓝色等。我浏览了 geoJson,但不确定如何在 flutter 中实现
无法在 MacOS X 中安装 google_maps_flutter,请评论该怎么做。 $ flutter --version Flutter 0.7.3-pre.26 • chan
我正在使用 google_maps_flutter 向谷歌地图添加标记我想在用户点击 InfoTextWindow 时显示一个新屏幕。 我似乎无法找到一种方法来做到这一点。有人知道吗? 我添加标记的方
我最近开始接触 Flutter,但就在我准备编写一些小部件测试时,我注意到我不太确定如何模拟 Google Maps Flutter 包。 我见过的许多例子包括使用库“mockito”来模拟类,但这假
我希望使用 .svg 图像作为图标放置标记。我正在使用 google_maps_flutter 库。这适用于 .png 转换后的图像,但我没有找到直接使用 .svg 文件的方法。 阅读此问题后,我在这
这样做的目的是将用户可以使用股票 google_maps_flutter 插件看到的周围地点变成可点击的标记。单击标记时,用户应该能够看到名称、开放时间、评论、图像等。 我一直坚持检索此类数据,并将其
是否可以使用 SVG 路径创建带有 google_maps_flutter 的标记?插入?我知道您可以通过以下方式使用 .png 文件: icon: BitmapDescriptor.fromAsse
我正在使用 google_maps_flutter并且希望在用户在 map 上执行手势时执行操作,无论是缩放/倾斜/移动/旋转。但是我无法使用 onCameraMoveStarted房产在Google
我是一名优秀的程序员,十分优秀!