【发布时间】:2019-05-18 19:25:04
【问题描述】:
我目前无法在使用 google_maps_flutter 包的 Flutter 应用程序内的嵌入式 GoogleMap 中显示位置图层。我已经在 AndroidManifest.xml 和 Info.plist 文件中声明了所需的权限,并将地图的 myLocationEnabled 属性设置为 true。生成的地图既不显示当前位置图标,也不显示“我的位置”按钮。
this 等问题似乎表明可能需要其他依赖项才能显示 Google 地图位置图层。但是,我不认为是这种情况。
我目前的方法是否遗漏了某些东西,还是需要额外的依赖?
我在我的 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>
地图代码:
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 dart flutter