Components
Card
A customizable card widget for displaying content with optional actions, background images, and tap handling.
Introduction
FluttyCard is a versatile card widget that provides a structured way to display content such as titles, descriptions, and actions. It supports customization options like background images, rounded corners, shadow effects, and allows primary and secondary action buttons. The card can also be made tappable for additional interactivity.
Usage
Basic Card
FluttyCard(
title: 'Welcome',
description: 'This is a customizable card widget.',
);Card with Actions
FluttyCard(
title: 'Action Card',
description: 'This card includes primary and secondary actions.',
primaryAction: () => print('Primary action triggered'),
secondaryAction: () => print('Secondary action triggered'),
primaryActionLabel: 'OK',
secondaryActionLabel: 'Cancel',
);Card with a Background Image
FluttyCard(
title: 'Card with Image',
description: 'This card has a background image.',
backgroundImage: 'https://via.placeholder.com/150',
primaryAction: () => print('Primary Action'),
);Clickable Card
FluttyCard(
title: 'Clickable Card',
description: 'Tap on the card to trigger an event.',
clickable: true,
onTap: () => print('Card tapped!'),
);API
FluttyCard Props
| Prop | Type | Default |
|---|---|---|
title | String | - |
description | String | - |
backgroundImage? | String? | - |
primaryAction? | VoidCallback? | - |
secondaryAction? | VoidCallback? | - |
primaryActionLabel? | String? | - |
secondaryActionLabel? | String? | - |
clickable? | bool | false |
onTap? | VoidCallback? | - |
radius? | RadiusVariant | RadiusVariant.md |
secondaryActionVariant? | ColorVariant? | - |
Features
1. Customizable Design
- Add rounded corners using the
radiusproperty based on your theme's design system. - Configure shadows for depth and emphasis.
- Use a custom background image via the
backgroundImageproperty.
2. Interactive Behavior
- Enable
clickableto make the card tappable, and use theonTapcallback to respond to user interactions. - Add primary and secondary action buttons for inline operations with support for customizable labels.
3. Thematic Support
- The card dynamically respects color and style variants defined in the
ThemeExtensionfor seamless theming across your app.
Notes
- If no
backgroundImageis supplied, the card will use the default background color defined by the theme with itsprimarycolor variant. - Primary and secondary buttons are optional. You can display either or both.
- Ensure the
radiusproperty matches your design system's guidelines for uniformity. - Use
FluttyCardto build reusable, scalable card components for a consistent UI experience.