IconButton constructor

const IconButton(
  1. {Key key,
  2. double iconSize: 24.0,
  3. VisualDensity visualDensity,
  4. EdgeInsetsGeometry padding: const EdgeInsets.all(8.0),
  5. AlignmentGeometry alignment: Alignment.center,
  6. @required Widget icon,
  7. Color color,
  8. Color focusColor,
  9. Color hoverColor,
  10. Color highlightColor,
  11. Color splashColor,
  12. Color disabledColor,
  13. @required VoidCallback onPressed,
  14. FocusNode focusNode,
  15. bool autofocus: false,
  16. String tooltip,
  17. bool enableFeedback: true,
  18. BoxConstraints constraints}
)

Creates an icon button.

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

Requires one of its ancestors to be a Material widget.

The iconSize, padding, autofocus, and alignment arguments must not be null (though they each have default values).

The icon argument must be specified, and is typically either an Icon or an ImageIcon.

Implementation

const IconButton({
  Key key,
  this.iconSize = 24.0,
  this.visualDensity,
  this.padding = const EdgeInsets.all(8.0),
  this.alignment = Alignment.center,
  @required this.icon,
  this.color,
  this.focusColor,
  this.hoverColor,
  this.highlightColor,
  this.splashColor,
  this.disabledColor,
  @required this.onPressed,
  this.focusNode,
  this.autofocus = false,
  this.tooltip,
  this.enableFeedback = true,
  this.constraints,
}) : assert(iconSize != null),
     assert(padding != null),
     assert(alignment != null),
     assert(autofocus != null),
     assert(icon != null),
     super(key: key);