【发布时间】:2018-10-27 02:45:09
【问题描述】:
我想要一排 IconButtons,彼此相邻,但实际图标和 IconButton 限制之间似乎有相当大的填充。我已经将按钮上的填充设置为 0。
这是我的组件,非常简单:
class ActionButtons extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
color: Colors.lightBlue,
margin: const EdgeInsets.all(0.0),
padding: const EdgeInsets.all(0.0),
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[
IconButton(
icon: new Icon(ScanrIcons.reg),
alignment: Alignment.center,
padding: new EdgeInsets.all(0.0),
onPressed: () {},
),
IconButton(
icon: new Icon(Icons.volume_up),
alignment: Alignment.center,
padding: new EdgeInsets.all(0.0),
onPressed: () {},
)
],
),
);
}
}
我想摆脱大部分浅蓝色空间,让我的图标在左侧更早开始,并且彼此靠近,但我找不到调整 IconButton 本身大小的方法。
我几乎可以肯定这个空间是由按钮本身占据的,因为如果我将它们的对齐方式更改为 centerRight 和 centerLeft,它们看起来像这样:
缩小实际图标也无济于事,按钮仍然很大:
感谢您的帮助
【问题讨论】:
-
你试过让你的实际图标变大吗?看起来图标可能居中,但没有填满,它是图标字体字形中的空间。
-
使用 GestureDetector( onTap: () {}, child: new Icon(Icons.volume_up) )
标签: flutter button flutter-layout flutter-widget iconbutton