flutter - Flutter_google_places 颤动,自动完成不显示结果
问题描述
我在使用 flutter_google_places 时遇到了问题。自动完成功能不起作用并E/SpannableStringBuilder(32620): SPAN_EXCLUSIVE_EXCLUSIVE spans cannot have a zero length
在控制台中返回。
我有一个注册的 api_key。
这是代码
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter/widgets.dart';
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:google_maps_webservice/places.dart';
import 'package:flutter_google_places/flutter_google_places.dart';
import 'package:geocoder/geocoder.dart';
const kGoogleApiKey = "api_key";
GoogleMapsPlaces _places = GoogleMapsPlaces(apiKey: kGoogleApiKey);
class _CreateNewPostFormState extends State<CreateNewPostForm> {
_getForm(BuildContext context, double screenWidth, double screenHeight) {
switch (_dropDownValue) {
case 1:
{
return Form(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Container(
width: screenWidth * 0.9,
padding: EdgeInsets.symmetric(vertical: 0, horizontal: 16),
margin: EdgeInsets.symmetric(vertical: 8),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Colors.grey[200],
),
child: TextFormField(
onTap: () async {
Prediction p = await PlacesAutocomplete.show(context: context, apiKey: kGoogleApiKey);
},
keyboardType: TextInputType.text,
decoration: InputDecoration(
border: InputBorder.none,
hintText:
AppLocalizations.of(context).translate('event_place'),
我应该怎么做才能有工作代码?
欢迎所有帮助谢谢!
解决方案
推荐阅读
- java - 当数据全为零时,如何将 y 范围从 0.3(这是默认值)扩展到 10?
- ios - 从 Swift Crash 日志中确定源代码行号
- java - 我的 HMACSHA256 签名验证几乎可以工作,但不完全
- excel - 使用 ListBox 输入值
- html - 更改字体样式时如何防止表格上下文调整大小/更改填充?
- javascript - 如何在运行会话(WebRTC、RTCMultiConnection)期间重新启动屏幕共享?
- asp.net - 在请求标头中输入 JWT 令牌时,自定义授权属性无法工作
- google-bigquery - 如何从 BigQuery 读取 Google Storage 存储桶中的每个文件并为存储桶中的每个文件创建一个表?
- python - 是否可以在熊猫的标题上方添加一行
- excel - 比较两个单元格值并仅突出显示文本