google-maps - 我想实现谷歌地图视图来获取用户点击的位置
问题描述
在 Android 中,我可以调用 Google Places 屏幕让用户选择一个位置来保存它,我想用颤振来做到这一点。
我搜索并发现几乎没有任何实现,我明白现在这是最官方的库(仍然没有实现我想要做的)https://pub.dartlang.org/packages/google_maps_flutter
它还没有完成(开发者预览)
解决方案
GoogleMap(
onTap: _mapTapped,
compassEnabled: true,
onMapCreated: makeController,
initialCameraPosition: CameraPosition(
target: LatLng(40.712776,-74.005974),
zoom: 12.0,
),
)
_mapTapped(LatLng location) {
print(location);
// The result will be the location you've been selected
// something like this LatLng(12.12323,34.12312)
// you can do whatever you do with it
}