flutter

How to resize (height and width) of an IconButton in Flutter


How to resize (height and width) of an IconButton in Flutter? Seems like it takes a default width and height. There is not height or width property.

new IconButton(
    padding: new EdgeInsets.all(0.0),
    color: themeData.primaryColor,
    icon: new Icon(Icons.clear, size: 18.0),
    onPressed: onDelete,
)

Solution

  • You can force it to size itself with the SizedBox.

    SizedBox(
       height: 18.0,
       width: 18.0,
       child: IconButton(
          padding: EdgeInsets.all(0.0),
          color: themeData.primaryColor,
          icon: Icon(Icons.clear, size: 18.0),
          onPressed: onDelete,
       )
    )