rozerro
rozerro

Reputation: 7216

IconButtons take too much space

I place thee IconButtons in the first Expanded. But they takes too much space around them. How to place them closer to each other?

Row(
      mainAxisAlignment: MainAxisAlignment.center,
      children: [
        Expanded(
          child: Row(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              IconButton(
                iconSize: 10,
                icon: FaIcon(FontAwesomeIcons.plus),
                onPressed: null,
              ),
              IconButton(
                iconSize: 10,
                icon: FaIcon(FontAwesomeIcons.asterisk),
                onPressed: null,
              ),
              IconButton(
                iconSize: 10,
                icon: FaIcon(FontAwesomeIcons.hashtag),
                onPressed: null,
              ),
            ],
          ),
        ),
        Expanded(...),
        Expanded(...),
      ],
    )
  ],
);

enter image description here

Upvotes: 0

Views: 114

Answers (2)

Thea Choem
Thea Choem

Reputation: 795

You can try this:

AspectRatio(
  aspectRatio: 1,
  child: IconButton(
    icon: Icon(Icons.ac_unit),
    onPressed: () {},
  ),
);

Upvotes: 2

Jorge Vieira
Jorge Vieira

Reputation: 3072

You could use RawMaterialButtons, then you use the BoxConstraints to set the size around it, look this aswer: https://stackoverflow.com/a/54963347/2831595

Upvotes: 2

Related Questions