IconButton take much width as it needs

It’s just a row mainAxisAlignment is spaceBetween

result :

enter image description here

it mus be like :

enter image description here

I don’t know why the IconButton take some more width ,

Row(
              mainAxisAlignment: MainAxisAlignment.spaceBetween,
              children: [
                IconButton(
                  onPressed: () {},
                  padding: EdgeInsets.zero, //<-- I try to remove the padding , but its not working
                  icon: const Icon(
                    Icons.close,
                    size: 20,
                    color: Color(0xFFBDBDBD),
                  ),
                ),
                Text(
                  'Log In',
                  style: GoogleFonts.inter(
                    fontSize: 30,
                    fontWeight: FontWeight.w700,
                  ),
                ),
                IconButton(
                  onPressed: () {},
                  icon: const Icon(Icons.close),
                ),
              ],
            ),```

  • It would be nice if you could show us the entire Widget code.

    – 

  • i think it’s related to IconButton , maybe there is some property that I must change, tried to make padding 0 but it’s not working, if I change IconButton and just use Icon(….) the icon go the the right place

    – 

  • I meant your entire Widget code please, I can’t see any error in the snipped code.

    – 

Leave a Comment