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
For those struggling with the TextFormField
that has a suffixIcon
or prefixIcon
not being allowed to be smaller due to the 48x padding, you can achieve so, by wrapping it with an IntrinsicHeight
that will force the child (TextFormField
in this case) to shrink to a more reasonable size, mostly like it will be sized to the input font size + any decoration padding.
However, have in mind that this should only be a workaround and there should be an option to set the icon padding manually. With this solution, if you have your icon bigger than the TextFormField
input text, it won't care and the Icon will overflow the box.