Button constructor

const Button({
  1. Key? key,
  2. required ButtonVariant variant,
  3. String? label,
  4. Widget? icon,
  5. Widget? trailingIcon,
  6. Color? color,
  7. String? tooltip,
  8. bool enable = true,
  9. bool enableHover = true,
  10. ButtonTitleExpand titleExpand = ButtonTitleExpand.none,
  11. Function? onPressed,
  12. Widget? child,
  13. String? semanticLabel,
  14. double? width,
  15. double? height,
  16. double? borderWidth,
  17. double? radius,
  18. EdgeInsets? padding,
  19. MainAxisSize? mainAxisSize,
  20. MainAxisAlignment? mainAxisAlignment,
  21. TextAlign? labelTextAlign,
})

Implementation

const Button({
  super.key,
  required this.variant,
  this.label,
  this.icon,
  this.trailingIcon,
  this.color,
  this.tooltip,
  this.enable = true,
  this.enableHover = true,
  this.titleExpand = ButtonTitleExpand.none,
  this.onPressed,
  this.child,
  this.semanticLabel,
  this.width,
  this.height,
  this.borderWidth,
  this.radius,
  this.padding,
  this.mainAxisSize,
  this.mainAxisAlignment,
  this.labelTextAlign,
}) : assert(
       (label != null && child == null) || (label == null && child != null),
       'Either label or child must be provided',
     );