【发布时间】:2022-01-12 05:16:47
【问题描述】:
我正在使用颤振并尝试实现谷歌地图。
从图片中可以看出,标记渲染在正确的位置,它只是没有渲染实际的地图。此外,我试图让地址搜索栏自动完成,但也没有任何结果。您可以在下面的第二个块中查看此代码。
Expanded(
child: GoogleMap(
onMapCreated: _onMapCreated, initialCameraPosition:
CameraPosition(
target: _center,
zoom: 11.0,
),
markers: {
Marker(markerId: MarkerId(searchField.text),
position: _center)
},
),
)
我已经创建了一个 API 密钥,并将其放入我的应用程序中。我按照教程将其纳入其中,但仍然一无所获。
对于 iOS,我在我的 AppDelegate.swift 和地址搜索机制的 geomethods 中注册了它。我还在 Info.plist 中提示了位置权限。我有什么遗漏吗?
// geoMethods
final geoMethods = GeoMethods(
googleApiKey: '(My API key was here, deleted for obvious reasons)',
language: 'en',
countryCode: 'us',
countryCodes: ['us', 'es', 'co'],
country: 'United States',
city: 'New York',
);
...
...
...
// Passed in for the search bar text field
onTap: () => showDialog(
context: context,
builder: (_) => AddressSearchBuilder.deft(
geoMethods: geoMethods,
controller: field,
builder: AddressDialogBuilder(
color: Color(0xFFE64225),
),
onDone: (Address address) {
print(address);
},
),
)
【问题讨论】:
标签: ios flutter google-cloud-platform