CustomActionButton.iconOnly constructor
CustomActionButton.iconOnly({
- Key? key,
- required VoidCallback? onPressed,
- required Widget icon,
- ButtonType baseType = ButtonType.elevated,
- Color? backgroundColor,
- Color? foregroundColor,
- Color? shadowColor,
- Color? splashColor,
- Color? disabledBackgroundColor,
- Color? disabledBorderColor,
- Color? disabledForegroundColor,
- Color? borderColor,
- Gradient? backgroundGradient,
- Gradient? disabledBackgroundGradient,
- double? size = 48.0,
- double? iconSize,
- EdgeInsetsGeometry? margin,
- OutlinedBorder? shape,
- double? elevation,
- InteractiveInkFeatureFactory? splashFactory,
- MaterialTapTargetSize tapTargetSize = MaterialTapTargetSize.padded,
Creates a circular button that displays only an icon.
This factory is designed to behave like IconButton, with a circular shape and a larger tap target by default.
Implementation
factory CustomActionButton.iconOnly({
Key? key,
required VoidCallback? onPressed,
required Widget icon,
ButtonType baseType = ButtonType.elevated,
Color? backgroundColor,
Color? foregroundColor,
Color? shadowColor,
Color? splashColor,
Color? disabledBackgroundColor,
Color? disabledBorderColor,
Color? disabledForegroundColor,
Color? borderColor,
Gradient? backgroundGradient,
Gradient? disabledBackgroundGradient,
double? size = 48.0,
double? iconSize,
EdgeInsetsGeometry? margin,
OutlinedBorder? shape,
double? elevation,
InteractiveInkFeatureFactory? splashFactory,
MaterialTapTargetSize tapTargetSize = MaterialTapTargetSize.padded,
}) {
final Widget themedIcon = IconTheme.merge(
data: IconThemeData(color: foregroundColor, size: iconSize),
child: icon,
);
return CustomActionButton(
key: key,
buttonType: baseType,
onPressed: onPressed,
backgroundColor: backgroundColor,
foregroundColor: foregroundColor,
shadowColor: shadowColor,
splashColor: splashColor,
disabledBackgroundColor: disabledBackgroundColor,
disabledBorderColor: disabledBorderColor,
disabledForegroundColor: disabledForegroundColor,
borderColor: borderColor,
backgroundGradient: backgroundGradient,
disabledBackgroundGradient: disabledBackgroundGradient,
width: size,
height: size,
minHeight: 0.0,
padding: EdgeInsets.zero,
margin: margin,
shape: shape ?? const CircleBorder(),
elevation: elevation,
splashFactory: splashFactory,
tapTargetSize: tapTargetSize,
child: themedIcon,
);
}