如何删除TextField下面的下划线? [英] How to remove underline below TextField?
本文介绍了如何删除TextField下面的下划线?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是代码。我想删除文本下方的黑色下划线,当前TextField处于编辑模式:
Here is the code. I want to remove the black underline just below text, and currently the TextField is in edit mode:
TextField(
autofocus: true,
decoration: InputDecoration.collapsed(
hintText: "Search",
border: InputBorder.none,
),
maxLines: 1,
)
推荐答案
尝试为您的TextField小部件提供TextStyle。您的TextField正在获取默认主题的TextStyle。
Try to give a TextStyle to your TextField widget. Your TextField is getting your default Theme's TextStyle.
TextField(
autofocus: true,
style: TextStyle(color: Colors.white, fontSize: 30),
decoration: InputDecoration.collapsed(
hintText: "Search",
border: InputBorder.none,
),
maxLines: 1,
)
在TextField窗口小部件中,源代码指出:
In TextField widgets source code it states:
/// If null, defaults to the `subhead` text style from the current [Theme].
final TextStyle style;
这篇关于如何删除TextField下面的下划线?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文