我将您的 IconButtons 放在第一个 Expanded 中。但是它们在周围占据了太多空间。如何让它们彼此靠近?
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(...),
],
)
],
);
答案 0 :(得分:1)
你可以使用 RawMaterialButtons,然后你使用 BoxConstraints 来设置它周围的大小,看看这个 aswer:https://stackoverflow.com/a/54963347/2831595
答案 1 :(得分:1)
我喜欢用这个:
AspectRatio(
aspectRatio: 1,
child: IconButton(
icon: Icon(Icons.ac_unit),
onPressed: () {},
),
);