chimeranext/flutter-boilerplate-monorepo-template / skills/flutter/stitch_to_flutter
stitch_to_flutter
VerifiedInstructions for translating Google Stitch designs (HTML/Tailwind) into production-ready Flutter/Dart code.
Stitch to Flutter Skill
This skill documents how to translate UI designs generated by Google Stitch (which come as HTML and Tailwind CSS) into Flutter widgets, ensuring alignment with your Flutter project architecture and design system.
Core Conversion Principles
-
Structure Mapping:
<div>withflex->Column,Row, orFlex.<div>withmax-w-md mx-auto->Center+ConstrainedBoxorContainerwithmaxWidth.padding(p-4,px-6) ->Paddingwidget orpaddingproperty inContainer/ListView.space-y-4->ListViewwithgap(if available) orColumnwithSizedBoxbetween items.
-
Style Mapping:
- Colors: Use
Theme.of(context).colorSchemefor dynamic colors. Map Tailwind custom colors (e.g.,primary: "#F97316") to the project's brand colors inlib/core/theme/. - Typography: Map Tailwind font weights (
font-bold) and sizes (text-3xl) toTextThemescale tokens.- CRITICAL: Never used hardcoded
fontSize. Always useTheme.of(context).textTheme.
- CRITICAL: Never used hardcoded
- Colors: Use
Typography Mapping Table
| Tailwind / Style | M3 Type Scale Token | Usage |
|---|---|---|
text-4xl, text-5xl | displayLarge/Medium/Small | Large hero text, brand elements |
text-2xl, text-3xl | headlineLarge/Medium/Small | High-emphasis page headers |
text-xl, font-bold | titleLarge/Medium/Small | Section headers, card titles |
text-base, text-sm | bodyLarge/Medium/Small | Long-form reading, descriptions |
text-xs, uppercase | labelLarge/Medium/Small | Buttons, badges, captions |
* **Shadows**: Map `shadow-lg` to `BoxShadow` in `BoxDecoration`.
* **Border Radius**: Map `rounded-2xl` to `BorderRadius.circular(16)`.
3. Component Mapping:
* button -> ElevatedButton, TextButton, or custom Material + InkWell for complex cards.
* header -> SliverAppBar or a custom AppBar.
* nav -> BottomNavigationBar or a custom navigation widget.
* span.material-icons-round -> Icon(Icons.<icon_name>).
- Tailwind Class to Flutter Decoration Table:
| Tailwind Class | Flutter Equivalent |
|---|---|
bg-white | color: Colors.white |
rounded-xl | borderRadius: BorderRadius.circular(12) |
shadow-md | BoxShadow(color: Colors.black12, blurRadius: 4, offset: Offset(0, 2)) |
border | border: Border.all(color: Colors.grey[200]!) |
flex items-center | Row(crossAxisAlignment: CrossAxisAlignment.center) |
flex flex-col | Column() |
Implementation Patterns
Complex Action Cards
For cards like "Informar de un animal vulnerable", use:
Material(
color: color,
borderRadius: BorderRadius.circular(24),
child: InkWell(
onTap: onTap,
child: Padding(
padding: const EdgeInsets.all(24),
// ... content
),
),
)
Dynamic Theme Usage
Always prioritize using Theme.of(context) to support Dark Mode automatically, as the Stitch designs often include dark: classes.
Atomic Design Mapping
When translating designs, follow the Atomic Design methodology to ensure components are reusable and well-structured:
| Level | Definition | Stitch/HTML Example | Flutter Equivalent |
|---|---|---|---|
| Atoms | Basic building blocks. | <button>, <input>, <span>, <img> | AppButton, AppTextInput, AppBadge, Icon |
| Molecules | Simple groups functioning together. | Labeled input, Icon + Text pair. | LabeledInput, StatItem, StatusIndicator |
| Organisms | Complex UI sections. | Personal Data Grid, Header with Avatar & Name. | ProfileHeader, FormSection, ActionGrid |
| Templates | Page structure without content. | Page with Header and Sticky Footer. | ProfilePageLayout |
| Pages | Completed page. | Entire screen. | ProfilePage |
Rules for Components:
- Atoms should be generic and stateless. They only import from theme/quarks.
- Molecules combine atoms and provide specific layout/logic for those atoms.
- Organisms handle layout of multiple molecules and may connect to state/data.
- Composition over duplication: If a pattern repeats in Stitch (e.g., an input card), extract it as a Molecule.
Dynamic Color & Branding
When converting designs, always use Theme.of(context).colorScheme tokens. The app uses Brand-Based Dynamic Color, meaning the entire ColorScheme is generated from the Brand Primary seed.
- NEVER hardcode hex colors for surfaces, containers, or secondary elements.
- Harmonized Colors: For semantic colors like "Warning" or "Success" that come from Stitch, use the
harmonized()extension if you need them to feel more integrated with the brand theme. - Semantic Mapping:
bg-primary->colorScheme.primarybg-primary-light->colorScheme.primaryContainertext-on-primary->colorScheme.onPrimarybg-surface->colorScheme.surface
Workflow
- Read the
.htmlfile from Stitch. - Examine the
.pngscreenshot to understand visual hierarchy and spacing. - Deconstruct into Atoms/Molecules: Identify repeated UI patterns (e.g., the input cards with labels).
- Generate the Dart code following the Atomic Design structure.
- Verify on Device: Execute the debug launch script to see the new screen in action:
make dev-mobile-launch
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 197k | Updated | Claude CodeCodex | Verified | Install |