Flutter Templates
Flutter UI you can preview live and copy.
Flutter Templates is an open-source library of real Flutter screens — from single widgets to full apps. Every component runs live in your browser, so you can interact with it, read the source, and copy it straight into your project.
Stop rebuilding the same login form, product grid, or onboarding flow on every app. Find it, try it, ship it.
What you can do here
- Browse by category — 240+ widgets across 35+ categories (auth, AI, admin, forms, chat, e-commerce, dashboard, navigation, maps, IoT, and more).
- Preview live — every widget runs as a real Flutter app in an in-browser preview, not a screenshot.
- Flip to the source — switch between the running preview and its Dart code, and copy it.
- Run full apps — food delivery, banking, team chat, retail POS, and a login and auth flow, running live with their full source.
- Add code with the CLI —
fluttertemplates add auth/login_herocopies a screen into your project. Seecli/. - Use it from an AI editor —
fluttertemplates mcpserves the library over MCP, and/llms.txtand/r/expose it to other tools. - Follow the guides — getting started, theming, Supabase, Firebase, go_router, Riverpod, Bloc, and responsive layouts.
- Search — jump straight to any widget or template by keyword.
How it works
The repo has two connected parts:
- Website + content (Astro):
src/ - Flutter source app for previews:
flutter_apps/core/
- The website renders content from Markdown.
- Widget pages embed the Flutter web app in an iframe.
- The iframe receives a
pathquery parameter and loads the matching Flutter screen.
Quick start
Prerequisites
- Node.js (LTS recommended)
pnpm(this repo usespnpm@10)- Flutter SDK (required to run or build widget previews)
Install
pnpm install
Run locally (full experience)
Run these in two terminals:
pnpm dev # Astro site
pnpm run-apps # Flutter web app on port 8989, for live iframe previews
If you run only pnpm dev, pages still load, but the widget previews won't work in dev mode.
Commands
pnpm dev— start the Astro dev serverpnpm run-apps— run the Flutter core app in the browser (--web-port 8989)pnpm build— generate the registry, then build the Astro sitepnpm registry— regeneratepublic/r/,public/llms.txt, andsrc/generated/pnpm build-apps— build the Flutter web app(s) and copy output topublic/flutter_apps/*pnpm preview— preview the built Astro outputpnpm deploy— build and deploy with Wranglerpnpm format— formatsrc/with Prettier
Content model
Content is powered by Astro collections defined in src/content.config.ts.
Widgets
Location: src/content/widgets/**
Common frontmatter fields:
titledescriptionapp(currentlycore)path(Flutter route used by the iframe, e.g./ecommerce/product_grid)previewSize(mobile,tablet,desktop)code_files(paths relative toflutter_apps/core/lib/)order,icon(for grouping and navigation)
---
title: Product Grid
description: Responsive grid of product cards
app: core
path: /ecommerce/product_grid
code_files: ["ecommerce/product_grid.dart"]
previewSize: mobile
---
Validation rules for code_files are enforced (no absolute paths, .., wildcards, or trailing slashes).
Text after the frontmatter is shown on the widget page as its technical note.
Generated registry
scripts/build-registry.mjs reads the content and Dart source and generates the catalogue used by the widget pages, the CLI, and MCP. Its output is gitignored and rebuilt by pnpm dev and pnpm build.
Guides
Location: src/content/guides/** (MDX with title, description, order). Embed a running screen with .
Templates
Location: src/content/templates/**
Templates that run in the core app set path (their route) and code_dir (their folder under flutter_apps/core/lib/). Their files use relative imports so the folder can be copied into any project.
Common frontmatter fields:
titledescriptiontype(micro-interaction,full-app,ui-kit,single-page,clone)heroImage,appImagesgithubUrl,demoUrl,youtubeVideoIdtags
How widget previews work
- Widget pages are generated from
src/pages/widgets/[...slug].astro. - The page loads source from
flutter_apps/based on/lib/* code_files. - The preview iframe points to:
http://localhost:8989/?path=&theme=
- production: /flutter_apps//index.html?path=&theme=
- Flutter route mapping lives in
flutter_apps/core/lib/main.dart(theroutesmap).
Project structure
src/pages/— Astro routes (home, widgets, templates, search, OG image routes)src/components/— Astro/React UI (header, sidebar, preview tabs, iframe, search)src/content/widgets/— widget metadata and contentsrc/content/templates/— template metadata and contentsrc/styles/global.css— theme tokens and global stylesflutter_apps/core/lib/— Flutter widget/template screens and the route mappublic/flutter_apps/core/— built Flutter web output (generated)scripts/build.js— builds all Flutter apps and copies artifacts topublic/flutter_apps/
Contributing
Add a widget
- Create the Dart screen in
flutter_apps/core/lib/./... - Register its route in
flutter_apps/core/lib/main.dart. - Add a Markdown entry in
src/content/widgets/with matching/ .md pathandcode_files. - For a new category, add
src/content/widgets/./index.md
Add a template
- Create
src/content/templates/.md. - Add image assets to
src/assets/template_images/as needed. - Fill in the frontmatter (
title,description,heroImage, links, tags, etc.).
Before opening a PR
- Make sure Markdown entries and Dart files match, and every
code_filespath exists. - Run
pnpm format. - Run
pnpm build. - If Flutter screens changed, run
pnpm build-appsand include the generated updates when appropriate.
License
MIT