- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我使用 SearchDelegate 实现了一个 SearchAppBar Material 并使用来自 this question 的响应更改了搜索委托(delegate)的提示文本默认值.
但是,我遇到了无法更改搜索字段提示文本字体样式的问题,如下图所示:
我已经有了我想要实现的样式,并且正在我的应用程序的其他字体中使用这种样式,但我也想将这种样式应用于此提示文本,以免违 react 用程序的样式指南。
我用于更改 Search Delegate 的默认消息的代码:
class SearchRoomAppBar extends SearchDelegate {
SearchRoomAppBar() : super(
searchFieldLabel: "Search user",
keyboardType: TextInputType.text,
textInputAction: TextInputAction.search,
);
}
最佳答案
SearchDelegate
应用栏文本的样式设置为 ThemeData.textTheme.headline6
。
默认情况下,SearchDelegate
使用您应用的 ThemeData
,但您可以覆盖 ThemeData appBarTheme(BuildContext context)
方法以返回自定义版本.
@override
ThemeData appBarTheme(BuildContext context) {
// You can use Theme.of(context) directly too
var superThemeData = super.appBarTheme(context);
return superThemeData.copyWith(
textTheme: superThemeData.textTheme.copyWith(
headline6: /* Whatever style you want to apply to your text */,
),
);
}
关于flutter - 更改 SearchDelegate Flutter 中 searchFieldLabel 的字体样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60013339/
我一直在尝试自定义 Flutter SearchDelgate到我想要的搜索字段的类型。它有一个名为 appBarTheme 的方法返回类型 ThemeData .通常使用 ThemeData您可以更
我创建了带有标签的产品,因此当用户按下标签按钮时,它将打开 SearchDelegate 并搜索该标签, 那么如何将标签名称传递给搜索委托(delegate)查询? 我的代码: class DataS
我用新类 extends SearchDelegate 创建了一个搜索函数。我想自定义 appBar 背景颜色,字体大小。如何实现? 我的搜索类 import 'package:flutter/mat
我突出显示了这个词,但不是正确的词。 在我的 BuilderSuggection 中,我添加了这样的代码, title: RichText( text: TextSpan(
我正在制作第一个要放在 App Store 上的应用程序。这是一个天气应用程序。将其命名为 Aer,所以请尽快查看!但无论如何,我已经基本完成了。不过有一件事困扰着我。每当我搜索一个城市时(每当我在
我是一个新手,我在将数据传递给我的搜索委托(delegate)类时遇到问题。问题是我有两个标签,我想在事件标签中搜索。所以我试图发送一个变量,告诉它是哪个选项卡以及要查找哪个表的值。 这是我的代码的样
我想通过添加带有一些单选按钮和其他小部件的表单来对搜索结果添加更多过滤器。文档指出 Radio 不保持状态,应该调用父级的 setState onChange 方法来重建小部件。调用 showModa
我的自动完成搜索工作正常,它在列表图 block 中显示结果。但我希望它转到我为每个搜索结果制作的不同页面 例如:这是我的字符串列表 final product=[ "shirts", "Sh
在 SearchDelegate 的当前实现中,没有更改提示文本的选项。当查询为空时,搜索屏幕会在查询字段中显示“搜索” 作为提示文本。 提示文本目前在第 395 行定义如下: final Strin
我想用showSearch从用户那里获取搜索文本(或查询)。我还想将最近的搜索显示为建议,并根据输入的文本过滤搜索历史。 那么我该如何实现呢? 最佳答案 custom_search_delgates.
我一直在关注 - boring flutter show 上的 Flutter 搜索教程.我一直在尝试使用从 future 列表派生的列表来实现相同的功能,其中数据来自 api(在本例中为 Aqued
我使用 SearchDelegate 实现了一个 SearchAppBar Material 并使用来自 this question 的响应更改了搜索委托(delegate)的提示文本默认值. 但是,
我正在尝试显示实时 http json 数据 mtgCardNames使用 buildResults .数据似乎已成功传递(它们被正确打印)但不知何故它们没有显示在屏幕上。为了了解情况,我尝试显示一些
我是一名优秀的程序员,十分优秀!