CNButton.icon constructor

const CNButton.icon({
  1. Key? key,
  2. CNSymbol? icon,
  3. IconData? customIcon,
  4. CNImageAsset? imageAsset,
  5. VoidCallback? onPressed,
  6. bool enabled = true,
  7. Color? tint,
  8. CNButtonConfig config = const CNButtonConfig(style: CNButtonStyle.glass),
})

Creates a round, icon-only variant of CNButton.

When padding, width, and minHeight are not provided in config, the button will be automatically sized to be circular based on the icon size.

At least one of icon, customIcon, or imageAsset must be provided.

Implementation

const CNButton.icon({
  super.key,
  this.icon,
  this.customIcon,
  this.imageAsset,
  this.onPressed,
  this.enabled = true,
  this.tint,
  this.config = const CNButtonConfig(style: CNButtonStyle.glass),
}) : label = null,
     assert(
       icon != null || customIcon != null || imageAsset != null,
       'At least one of icon, customIcon, or imageAsset must be provided',
     ),
     super();