是否可以更改文本和边框之间的 margin/padding?

Is it possible to change the margin/padding between the text and the border?

我的问题很容易解释。正如标题所说,是否可以更改 TextField 中文本和边框之间的 margin/padding? 更准确地说,文本基线和文本字段的下划线边框之间的边距。

我可以暴力破解它,然后在我想要的地方画一条线,然后停止绘制边框。但是自动错误验证器看起来不太好。

是的,您可以将 decoration 参数传递给 TextField。它接受 InputDecoration,它有 contentPadding 参数。

对于任何自定义装饰,您可以使用 TextField 小部件提供的 InputDecoration。然后从那里编辑默认填充或做任何样式