Fontawesome icon in Flutter

krupnik21 :

why my icon in CircleAvatar is not in centre?

enter image description here

                    Column(
                      crossAxisAlignment: CrossAxisAlignment.center,
                      children: <Widget>[
                        IconButton(
                          icon: CircleAvatar(
                            child: Icon(FontAwesomeIcons.tshirt, color: Colors.white,),
                            radius: 60.0,
                            backgroundColor: Colors.cyan
                          ),
                          iconSize: 50.0,
                          onPressed: () {
                            //
                          },
                        ),
                        Text('Odzież')
                      ],
                    ),

I use fontawesome to add icon, but after adding icon, he is not in thecentre of the circle avatar, have anybody any solutions to this problem?

Viren V Varasadiya :

I think this is very common issue with this library.

You have to use FaIcon widget which come with the package. They also mention this issue in their documentations FAQ.

Solution :

Just Replace your icon widget with FaIcon.

CircleAvatar(
   child: FaIcon(FontAwesomeIcons.tshirt, color: Colors.white,), // Icon widget changed with FaIcon
        radius: 60.0,
         backgroundColor: Colors.cyan
    ),

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=410741&siteId=1