android - 当使用空格时,flutter-autocomplete-textfield 不提示
问题描述
我正在使用autocomplete_textfield并且它工作得很好,直到我在 2 个单词之间添加一个空格,它停止建议任何东西.. 这是我的代码:
AutoCompleteTextField<String>(
decoration: InputDecoration(
filled: true,
fillColor: Colors.white,
hintText: S.of(context).starting_location_hint),
itemFilter: (suggestion, input) => suggestion
.toLowerCase()
.contains(input.toLowerCase()),
suggestions: suggestions,
itemSorter: (String a, String b) {
return a.compareTo(b);
},
itemSubmitted: (String data) async {
cardKey.currentState.toggleCard();
fromPicked = true;
fromLocationName = data;
await movingCameraToLocation(
double.parse(
allStations[suggestions.indexOf(data)]
.stationLatitude),
double.parse(
allStations[suggestions.indexOf(data)]
.stationLongitude));
setState(() {});
},
itemBuilder:
(BuildContext context, String suggestion) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: <Widget>[
Text(
suggestion,
textAlign: TextAlign.right,
style: TextStyle(fontSize: 12),
)
],
),
);
},
key: startKey,
)
有什么帮助吗?
解决方案
推荐阅读
- python - PyQt5 在插槽中使用 lambda 的可变引用问题
- python - Flask-Admin 视图所需的 Flask-basicAuth auth 装饰器
- spring-integration - 如何将 ID 设置为 http 入站网关(DSL 样式)?
- httprequest - 使用 LoadBodyFromString 时 ChilkatHttpRequest 将 CR 转换为 CRLF
- dns - 设置 DKIM 私钥?我把它放在哪里?里面的细节
- python - "sock.sendto(bytes, (ip, port))""AttributeError: 'str' object has no attribute 'sendto'"
- reactjs - 将 baseURL 设置为 window.location.origin 以进行生产/heroku 部署是一种好习惯吗?
- c# - 保存用户名,并显示在其他页面上
- angularjs - 如何访问 angularjs 控制器中的 DOM 元素?
- c++ - QString split 也在 '.' 处分裂。