CardImage constructor

const CardImage({
  1. Key? key,
  2. required Widget image,
  3. Widget? title,
  4. Widget? subtitle,
  5. Widget? trailing,
  6. Widget? leading,
  7. VoidCallback? onPressed,
  8. bool? enabled,
  9. AbstractButtonStyle? style,
  10. Axis? direction,
  11. double? hoverScale,
  12. double? normalScale,
  13. Color? backgroundColor,
  14. Color? borderColor,
  15. double? gap,
})

Creates a CardImage.

The image parameter is required and should contain the primary visual content. All other parameters are optional and provide customization for layout, interaction, and styling.

Parameters:

  • image (Widget, required): primary image content
  • title (Widget?): optional title text or widget
  • subtitle (Widget?): optional subtitle below title
  • trailing (Widget?): optional widget on the end side
  • leading (Widget?): optional widget on the start side
  • onPressed (VoidCallback?): tap callback, enables interaction
  • enabled (bool?): whether card responds to interaction
  • style (AbstractButtonStyle?): custom button styling
  • direction (Axis?): vertical or horizontal layout
  • hoverScale (double?): image scale on hover (default: 1.05)
  • normalScale (double?): normal image scale (default: 1.0)
  • backgroundColor (Color?): image background color
  • borderColor (Color?): image border color
  • gap (double?): spacing between image and content

Example:

CardImage(
  image: Image.asset('assets/photo.jpg'),
  title: Text('Beautiful Landscape'),
  subtitle: Text('Captured in the mountains'),
  direction: Axis.horizontal,
  hoverScale: 1.1,
  onPressed: () => showDetails(),
);

Implementation

const CardImage({
  super.key,
  required this.image,
  this.title,
  this.subtitle,
  this.trailing,
  this.leading,
  this.onPressed,
  this.enabled,
  this.style,
  this.direction,
  this.hoverScale,
  this.normalScale,
  this.backgroundColor,
  this.borderColor,
  this.gap,
});