SingImage constructor

SingImage(
  1. String imagePath, {
  2. Key? key,
  3. double? width,
  4. double? height,
  5. double marginBottom = 0,
  6. double marginRight = 0,
  7. double marginTop = 0,
  8. double marginLeft = 0,
  9. double margin = 0,
  10. double cornerRadius = 0,
  11. bool isCircle = false,
  12. Color borderColor = Colors.transparent,
  13. double borderWidth = 0,
  14. Color backgroundColor = Colors.transparent,
  15. Color? color,
  16. VoidCallback? onClick,
})

Implementation

SingImage(this.imagePath, { super.key,
  this.width,
  this.height,
  this.marginBottom = 0,
  this.marginRight = 0,
  this.marginTop = 0,
  this.marginLeft = 0,
  this.margin = 0,
  this.cornerRadius = 0,
  this.isCircle = false,
  this.borderColor = Colors.transparent,
  this.borderWidth = 0,
  this.backgroundColor = Colors.transparent,
  this.color,
  this.onClick,
}) {
  if (margin > 0) {
    marginLeft = margin;
    marginTop = margin;
    marginRight = margin;
    marginBottom = margin;
  }

  if (isCircle) {
    cornerRadius = width ?? 0 / 2;
  }

  if(height == null && width != null){
    height = width;
  }
  onClick ??= () {};
}