如何在颤振中调整IconButton的大小(高度和宽度)?它似乎需要一个默认的宽度和高度。没有高度或宽度属性。
new IconButton(
padding: new EdgeInsets.all(0.0),
color: themeData.primaryColor,
icon: new Icon(Icons.clear, size: 18.0),
onPressed: onDelete,
)发布于 2018-03-10 15:52:40
您可以强迫它使用SizedBox来调整自身的大小。
new SizedBox(
height: 18.0,
width: 18.0,
child: new IconButton(
padding: new EdgeInsets.all(0.0),
color: themeData.primaryColor,
icon: new Icon(Icons.clear, size: 18.0),
onPressed: onDelete,
)
)发布于 2019-06-21 16:28:48
有一种比公认的答案更新的方法。看起来是这样的:
IconButton(
iconSize: 18.0,
icon: new Icon(Icons.clear)因此,使用iconSize属性并去掉SizedBox。
我注意到,旧的接受的解决方案有一个坏的绘图效果时,按下按钮。
发布于 2020-01-18 00:05:29
您可以将IconButton替换为InkWell:
InkWell(
child: Icon(Icons.clear, size: 18.0, color: themeData.primaryColor),
onTap: onDelete,
),https://stackoverflow.com/questions/49211024
复制相似问题