Google maps 如何实现flattergoogleplace包
如何使用Flitter google place软件包,以及如何只在屏幕上实现它,而不在Flitter中打开新屏幕Google maps 如何实现flattergoogleplace包,google-maps,flutter,google-places-api,Google Maps,Flutter,Google Places Api,如何使用Flitter google place软件包,以及如何只在屏幕上实现它,而不在Flitter中打开新屏幕 颤振google place软件包-软件包支持模式。覆盖 调用placesautomplete.show时,将模式设置为mode.overlay 代码片段 body: Center( child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
颤振google place软件包-软件包支持
模式。覆盖
调用placesautomplete.show
时,将模式设置为mode.overlay
代码片段
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
_buildDropdownMenu(),
RaisedButton(
onPressed: _handlePressButton,
child: Text("Search places"),
),
...
Widget _buildDropdownMenu() => DropdownButton(
value: _mode,
items: <DropdownMenuItem<Mode>>[
DropdownMenuItem<Mode>(
child: Text("Overlay"),
value: Mode.overlay,
),
DropdownMenuItem<Mode>(
child: Text("Fullscreen"),
value: Mode.fullscreen,
),
],
onChanged: (m) {
setState(() {
_mode = m;
});
},
);
...
Future<void> _handlePressButton() async {
// show input autocomplete with selected mode
// then get the Prediction selected
Prediction p = await PlacesAutocomplete.show(
context: context,
apiKey: kGoogleApiKey,
onError: onError,
mode: _mode,
language: "fr",
components: [Component(Component.country, "fr")],
);
displayPrediction(p, homeScaffoldKey.currentState);
}
主体:中心(
子:列(
mainAxisAlignment:mainAxisAlignment.center,
儿童:[
_buildDropdownMenu(),
升起的按钮(
按下时:_handlepress按钮,
子项:文本(“搜索位置”),
),
...
小部件_buildDropdownMenu()=>DropdownButton(
值:_模式,
项目:[
下拉菜单项(
子项:文本(“覆盖”),
值:Mode.overlay,
),
下拉菜单项(
子:文本(“全屏”),
值:Mode.fullscreen,
),
],
变更后:(m){
设置状态(){
_模式=m;
});
},
);
...
Future\u handlePressButton()异步{
//显示所选模式下的输入自动完成
//然后选择预测
预测p=等待地点SautoComplete.show(
上下文:上下文,
apiKey:kGoogleApiKey,
onError:onError,
模式:_模式,
语言:“fr”,
成分:[成分(成分国,“fr”)],
);
显示预测(p,homeScaffoldKey.currentState);
}
您可以直接复制粘贴运行示例
完整示例
我知道,但我想在自定义文本字段中搜索位置。