Home > Software design >  Flutter- Reduce padding between hintText and suffixIcon for TextFormField
Flutter- Reduce padding between hintText and suffixIcon for TextFormField

Time:02-23

I have a TextFormField with hintText and suffixIcon. Currently the hint text is overflowing with ellipsis indication. There is a lot of space between hint text and the suffix icon which I want to reduce or at least remove the overflow and show the text completely.

I tried to achieve this with setting the hintStyle property by making the overflow visible, but still the ellipsis is appearing. How can we resolve this?

enter image description here

TextFormField(
        initialValue:'Value',
        onTap:() {},
        decoration: InputDecoration(
          hintText:'Select Date',
          hintStyle: const TextStyle(overflow: TextOverflow.visible),
          isDense: true,
          suffixIcon: suffixIcon,
          suffixIconConstraints: const BoxConstraints(
            minWidth: 25,
            minHeight: 25,
          ),
        ),
      ),

CodePudding user response:

Try below code hope its help to you. Try to add image

CodePudding user response:

You can use isDense: true

his will remove the default content padding now you can customize it here or add padding widget

Then, You can use Content padding to give padding to the widgets inside.

contentPadding: EdgeInsets.symmetric(horizontal: 0, vertical: 0),
  • Related