我目前无法使用 google_maps_flutter 在 Flutter 应用程序中的嵌入式 GoogleMap 中显示位置层包裹。我已经在 AndroidManifest.xml 和 Info.plist 文件中声明了所需的权限,并将 map 的 myLocationEnabled 属性设置为 true。生成的 map 既不显示当前位置图标,也不显示“我的位置”按钮。
this等问题似乎暗示可能需要另一个依赖项才能显示 Google map 位置层。但是,我不认为是这种情况。
我是否遗漏了当前方法中的某些内容,或者我是否需要额外的依赖项?
我在我的 AndroidManifest.xml 中包含了以下内容:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
以及我的 Info.plist 中的以下内容:
<key>io.flutter.embedded_views_preview</key>
<true/>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Application needs to access your current location</string>
<key>NSLocationAlwaysUsageDescription</key>
<string>Application needs to access your current location</string>
map 代码:
return GoogleMap(
mapType: MapType.normal,
initialCameraPosition: _lakeGenevaPos,
markers: _markers,
polylines: _polylines,
myLocationEnabled: true,
onMapCreated: (GoogleMapController controller) => _onMapCreated(controller),
);
pubspec.yaml 依赖:
google_maps_flutter: ^0.5.13
最佳答案
关于google-maps - Flutter:如何在谷歌地图中显示位置图层,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56202184/