在 SearchDelegate
的当前实现中,没有更改提示文本的选项。当查询为空时,搜索屏幕会在查询字段中显示“搜索” 作为提示文本。
提示文本目前在第 395 行定义如下:
final String searchFieldLabel = MaterialLocalizations.of(context).searchFieldLabel;
然而,有一个 existing issue to this subject reported .
我无法为此提出任何解决方案。 您知道该问题的任何解决方法吗?
最佳答案
目前 SearchDelegate 有一个可选成员“searchFieldLabel”来指定搜索字段的标签。 它应该看起来像这样:
@override
String get searchFieldLabel => 'custom label';
https://stackoverflow.com/questions/54518741/