简体   繁体   English

如何删除 TextFormField Flutter 中的额外空间

[英]How can remove Extra space in TextFormField Flutter

When I used the suffixIcon so space between hint text and underline is little bit show extra and without suffixIcon it's look perfect.当我使用 suffixIcon 时,提示文本和下划线之间的空间有点多余,没有 suffixIcon 它看起来很完美。 if you see in below image I have used the suffixIcon in "New Password" and "Confirm Password" So there is little bit extra space between hint text and underline but in "Old Password" i have not use the suffixIcon So it's look perfect.如果您在下图中看到,我在“新密码”和“确认密码”中使用了 suffixIcon 所以提示文本和下划线之间有一点额外的空间,但在“旧密码”中我没有使用 suffixIcon 所以它看起来很完美。 I have also try with set suffixIcon size but it's not working, So please help me for how can I remove the extra space when using the suffixIcon?我也尝试过设置 suffixIcon 大小,但它不起作用,所以请帮助我了解如何在使用 suffixIcon 时删除多余的空间?

You can see below with both code and UI.您可以在下面看到代码和 UI。

在此处输入图像描述

Use contentPadding property of TextFormField to maintain equal amount of space regardless of if whether it has suffixIcon or not:使用 TextFormField 的 contentPadding 属性来保持等量的空间,无论它是否有 suffixIcon:

contentPadding:
              const EdgeInsets.symmetric(horizontal: 10, vertical: 12),

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM