Skip to content

Card ​

A Container-based card with elevation, flat, and outlined looks, plus an optional onTap so it doubles as a tappable surface.

View source on GitHub ↗

CLI ​

Install this component into your project:

card
$flutter_beautify add card

Variants ​

FBCard.elevated() · FBCard.flat() · FBCard.outlined() — the plain constructor forwards to .elevated().

Key parameters ​

ParameterTypeDefault
childWidgetrequired
backgroundColorColor?ambient colorScheme.surface (surfaceContainerHighest for .flat)
padding / marginEdgeInsetsGeometryall(16) / all(8)
borderRadiusBorderRadiuscircular(12)
onTapVoidCallback?—
width / heightdouble?—

.outlined() adds borderColor and borderWidth instead of a shadow.

Usage ​

dart
import 'package:your_app/widgets/card.dart';

FBCard.outlined(
  onTap: () => openDetails(item.id),
  child: ListTile(title: Text(item.name)),
);

Released under the MIT License.