CommonButton constructor

const CommonButton({
  1. Key? key,
  2. String? label,
  3. IconData? icon,
  4. CommonButtonVariant variant = CommonButtonVariant.primary,
  5. required VoidCallback? onTap,
  6. Color? color,
  7. double? width,
  8. String? semanticLabel,
  9. 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',
     );