在 flutter_typehead TypeAheadField 小部件中,如何自定义让用户知道没有找到匹配项的消息?
In flutter_typehead TypeAheadField widget, how do I customize the message letting user know there is no matching item found?
我正在尝试使用此模块 https://github.com/AbdulRahmanAlHamali/flutter_typeahead 制作具有自动完成/“提前输入”功能的文本字段。
当用户在文本字段表单中搜索项目但未找到该项目时,会返回一条 'No Item Found' 消息。我如何自定义此消息以进行本地化?
TypeAheadFormField 提供了一个回调,可用于自定义消息“找不到项目”。我没有在文档中看到它,但它可用。回调是:noItemsFoundBuilder .
这里是使用此回调的示例代码:
TypeAheadFormField(
textFieldConfiguration: TextFieldConfiguration(
controller:
decoration:
)),
itemBuilder: (context, suggestion) {
return ListTile(
title: Text(''),
);
},
noItemsFoundBuilder: (value) {
var localizedMessage = "Parlez-vous Français!";
return Text(localizedMessage);
}, )
我正在尝试使用此模块 https://github.com/AbdulRahmanAlHamali/flutter_typeahead 制作具有自动完成/“提前输入”功能的文本字段。
当用户在文本字段表单中搜索项目但未找到该项目时,会返回一条 'No Item Found' 消息。我如何自定义此消息以进行本地化?
TypeAheadFormField 提供了一个回调,可用于自定义消息“找不到项目”。我没有在文档中看到它,但它可用。回调是:noItemsFoundBuilder .
这里是使用此回调的示例代码:
TypeAheadFormField(
textFieldConfiguration: TextFieldConfiguration(
controller:
decoration:
)),
itemBuilder: (context, suggestion) {
return ListTile(
title: Text(''),
);
},
noItemsFoundBuilder: (value) {
var localizedMessage = "Parlez-vous Français!";
return Text(localizedMessage);
}, )