How to remove space between prefixIcon and texformfield text?

Issue

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.

Solution

Try with this

TextFormField(
            decoration: const InputDecoration(
            prefixIcon: Text("118"),
            prefixIconConstraints: BoxConstraints(maxWidth: 40)),
)

Answered By – masum billah sanjid

Answer Checked By – Pedro (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.