CNButton.icon constructor
const
CNButton.icon({
- Key? key,
- CNSymbol? icon,
- IconData? customIcon,
- CNImageAsset? imageAsset,
- VoidCallback? onPressed,
- bool enabled = true,
- Color? tint,
- int? badgeCount,
- 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.
Optionally, a badgeCount can be provided to display a notification badge
on the button (displayed as "99+" for counts > 99).
Implementation
const CNButton.icon({
super.key,
this.icon,
this.customIcon,
this.imageAsset,
this.onPressed,
this.enabled = true,
this.tint,
this.badgeCount,
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();