0

如何在颤动中添加谷歌地图自动完成搜索框?

我想使用飞镖在谷歌地图中添加一个自动完成搜索框。

4

1 回答 1

0

在 pubspec.yaml 中添加依赖项

  flutter_google_places:

之后,您可以使用此方法

Future<void> _handlePressButton() async {
    // show input autocomplete with selected mode
    // then get the Prediction selected
    Prediction p = await PlacesAutocomplete.show(
      context: context,
      apiKey: 'your_api_key',
//      onError: onError,
      mode: Mode.overlay,
      language: "en",
      components: [Component(Component.country, "in")],
    );

  }
于 2020-01-08T07:58:02.070 回答