class IconButton extends StatelessWidget { /// 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]. const IconButton({ super.key, this.iconSize, this.visualDensity, this.padding = const EdgeInsets.all(8.0), this.alignment = Alignment.center, this.splashRadius, this.color, this.focusColor, this.hoverColor, this.highlightColor, this.splashColor, this.disabledColor, required this.onPressed, this.mouseCursor, this.focusNode, this.autofocus = false, this.tooltip, this.enableFeedback = true, this.constraints, this.style, this.isSelected, this.selectedIcon, required this.icon, }) : assert(padding != null), assert(alignment != null), assert(splashRadius == null || splashRadius > 0), assert(autofocus != null), assert(icon != null);
使用 hoverColor
更新背景可以使用透明色