CommonButton constructor
const
CommonButton({
- Key? key,
- String? label,
- IconData? icon,
- CommonButtonVariant variant = CommonButtonVariant.primary,
- required VoidCallback? onTap,
- Color? color,
- double? width,
- String? semanticLabel,
- bool loading = false,
Implementation
const CommonButton({
super.key,
this.label,
this.icon,
this.variant = CommonButtonVariant.primary,
required this.onTap,
this.color,
this.width,
this.semanticLabel,
this.loading = false,
}) : assert(
variant == CommonButtonVariant.icon ? icon != null : label != null,
'label required for text variants, icon required for icon variant',
);