Skip to content

feat(card): Card primitive (shadcn v4) + gallery showcase#48

Merged
SiphoChris merged 6 commits into
mainfrom
feat/flutterbits-card
Jun 15, 2026
Merged

feat(card): Card primitive (shadcn v4) + gallery showcase#48
SiphoChris merged 6 commits into
mainfrom
feat/flutterbits-card

Conversation

@SiphoChris

Copy link
Copy Markdown
Owner

Card — the second flutterbits primitive (shadcn v4 parity)

Ships Card and its compound subcomponents as Material-free, themeable, copy-paste source in apps/gallery, and establishes the canonical template for compound / non-interactive components (complementing button.dart, the interactive template).

What's included

  • Card + CardHeader / CardTitle / CardDescription / CardAction / CardContent / CardFooter — one cohesive file (apps/gallery/lib/components/ui/card.dart), mirroring shadcn's single card.tsx.
  • Styled entirely through flutterwindcss semantic tokens (card, cardForeground, border, mutedForeground) + theme-resolved roundedXl / shadowSm, so any pasted theme reskins it.
  • Gallery showcase + smoke test; golden grid (light / dark / RTL).

Faithful shadcn v4 mapping

Part shadcn className
Card flex flex-col gap-6 rounded-xl border bg-card py-6 text-card-foreground shadow-sm
CardHeader items-start gap-2 px-6 · two-col when an action is present · [.border-b]:pb-6
CardTitle leading-none font-semibold
CardDescription text-sm text-muted-foreground
CardContent px-6
CardFooter flex items-center px-6 [.border-t]:pt-6

Design decisions (rationale in the plan + doc-comments)

  • CompositionCard(children: [...]) with subcomponent widgets, mirroring shadcn's compound-component DX.
  • CardHeader uses explicit title/description/action slots instead of generic children, because shadcn's has-data-[slot=card-action]:grid-cols-[1fr_auto] (sibling-presence detection) has no Flutter analog. With an action, the title/description column is Expanded beside the top-end action; without one, they stack. A faithful-result / idiomatic-means substitution that preserves the capability bar — not a scope cut.
  • Block-level (crossAxisAlignment: stretch) — fills (and requires) a bounded-width parent, like a <div>; documented. Horizontal padding lives on the sections (px-6), the card carries only py-6 + gap-6, so full-bleed dividers/images work.
  • CardFooter is full-width so Spacer / Expanded / MainAxisAlignment work (the canonical "Cancel … Save" footer), matching shadcn's block-level footer.
  • Non-interactive (shadcn's is too) — a tappable card composes a wrapper.

Tests

  • 11 behavior tests: token reskin (dark card present + light absent), the mutedForeground override vs cardForeground title (resolved via RichText), action two-column layout, bordered-divider presence and absence (BorderDirectional distinguishes the divider from the card's uniform border), RTL composition with no overflow.
  • Golden grid (light / dark / RTL). ⚠️ Generated on Windows — provisional; will be re-baselined from the CI Linux artifact (the established gallery-golden-failures recipe) in a follow-up commit on this branch.
  • flutter analyze --fatal-infos --fatal-warnings clean; dart format clean.

No-drift

  • AGENTS.md §6/§12 — canonical templates are now button.dart (interactive) + card.dart (compound/non-interactive); corrected the stale registry/button.dart reference (components live in apps/gallery until the registry/CLI promotion).
  • charter §8 — records the primitives-before-structure sequencing (a sequencing change, not a scope change).

Review

Built via subagent-driven development: fresh implementer per unit + spec-compliance and code-quality reviews between units, plus a final whole-slice Opus review (which caught the footer MainAxisSize issue, now fixed).

🤖 Generated with Claude Code

Sipho Nkebe and others added 5 commits June 15, 2026 09:50
TDD, subagent-driven plan for the Card primitive (shadcn v4) + gallery integration.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…ctive

Card + CardHeader/Title/Description/Action/Content/Footer; Material-free, styled through flutterwindcss semantic tokens (card/cardForeground/border/mutedForeground). Composed subcomponents; CardHeader uses explicit title/description/action slots (Flutter has no has-[sibling] selector); CardFooter is full-width so Spacer/end-alignment work like shadcn. 11 behavior tests: token reskin, mutedForeground override, action layout, divider presence+absence, RTL.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…oritative

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…no-drift)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 15, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
flutterbits Ready Ready Preview, Comment Jun 15, 2026 7:57am

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@SiphoChris SiphoChris merged commit 37e4017 into main Jun 15, 2026
8 checks passed
@SiphoChris SiphoChris deleted the feat/flutterbits-card branch June 15, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant