4

enter image description here

How to remove space after prefix icon in TextFormField in flutter? I've already tried isCollapsed = true, isDense = true. And I have set my contentPadding: EdgeInsets.all(0). Using prefix instead of prefixIcon however solves my issue, but there is another problem. Prefix appears only on focus. How to solve my problem? I want to prefix(or prefixIcon) to appear always visible at the beginning. And TextFormField's text must be like continue of the prefix.

2 Answers2

2

Try with this

TextFormField(
            decoration: const InputDecoration(
            prefixIcon: Text("118"),
            prefixIconConstraints: BoxConstraints(maxWidth: 40)),
)
Masum Billah Sanjid
  • 1,029
  • 1
  • 7
  • 19
0

I was facing the issue with contentPadding i have provided make it condtional content padding.

contentPadding:Padding.only(left:prefixWidget!=null?0:20,),