如何从TextField中删除内容填充? [英] How do I remove content padding from TextField?
本文介绍了如何从TextField中删除内容填充?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是不熟悉flutter的人,并且正在创建登录表单,为此我使用了TextField并添加了前缀图标,但是在文本字段之间(用户ID和Pin)以及前缀图标之前,我得到了一些额外的空格.我也尝试了InputDecorationTheme,但是没有用.
I am new to flutter and I am creating login form, for that I have used TextField and added prefix icon but I am getting some extra spaces in between textfields (user id and pin) and before the prefix icon. I have also tried InputDecorationTheme but it didn't work.
请让我知道如何删除或减少空间.?
Please let me know how can I remove or reduce the space.??
下面是我的代码:
TextField(
maxLength: 8,
keyboardType: TextInputType.number,
decoration: InputDecoration(
hintText: hint,
hintStyle: TextStyle(fontSize: 12.0),
prefixIcon: Icon(icon),
counterText: '',
),
)
推荐答案
您可以使用InputDecoration的contentPadding
.
这是示例代码
You can use contentPadding
of InputDecoration.
Here is sample code
TextField(
maxLines: 8,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 5),
labelText: 'Description',
labelStyle: txtHintStyle,
)
)
这篇关于如何从TextField中删除内容填充?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文