A material design icon button.

An icon button is a picture printed on a Material widget that reacts to touches by filling with color (ink).

Icon buttons are commonly used in the AppBar.actions field, but they can be used in many other places as well.

If the onPressed callback is null, then the button will be disabled and will not react to touch.

Requires one of its ancestors to be a Material widget.

The hit region of an icon button will, if possible, be at least 48.0 pixels in size, regardless of the actual iconSize, to satisfy the touch target size requirements in the Material Design specification. The alignment controls how the icon itself is positioned within the hit region.

Sample code

new IconButton(
  icon: new Icon(Icons.volume_up),
  tooltip: 'Increase volume by 10%',
  onPressed: () { setState(() { _volume *= 1.1; }); },

See also:



IconButton({Key key, double iconSize: 24.0, EdgeInsets padding: const EdgeInsets.all(8.0), FractionalOffset alignment: FractionalOffset.center, @required Widget icon, Color color, Color disabledColor, @required VoidCallback onPressed, String tooltip })
Creates an icon button. [...]


alignment FractionalOffset
Defines how the icon is positioned within the IconButton. [...]
color Color
The color to use for the icon inside the button, if the icon is enabled. Defaults to leaving this up to the icon widget. [...]
disabledColor Color
The color to use for the icon inside the button, if the icon is disabled. Defaults to the ThemeData.disabledColor of the current Theme. [...]
icon Widget
The icon to display inside the button. [...]
iconSize double
The size of the icon inside the button. [...]
onPressed VoidCallback
The callback that is called when the button is tapped or otherwise activated. [...]
padding EdgeInsets
The padding around the button's icon. The entire padded icon will react to input gestures. [...]
tooltip String
Text that describes the action that will occur when the button is pressed. [...]
hashCode int
The hash code for this object. [...]
read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited


build(BuildContext context) Widget
Describes the part of the user interface represented by this widget. [...]
debugFillDescription(List<String> description) → void
Add additional information to the given description for use by toString. [...]
createElement() StatelessElement
Creates a StatelessElement to manage this widget's location in the tree. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toString() String
Returns a string representation of this object.
toStringShort() String
A short, textual description of this widget.


operator ==(other) bool
The equality operator. [...]