Flutter Templates is a curated library of Flutter UI patterns that you can browse, run, and learn from.
It is built for developers who want to move faster when building mobile apps: instead of starting every screen from scratch, you can explore ready-made widgets and full template ideas, then adapt the code to your own project.
Live website: fluttertemplates.dev
- Browse Flutter widgets by category (forms, ecommerce, dashboard, navigation, and more)
- Open each widget page and view a runnable preview
- Switch between preview and source code
- Explore full app templates with screenshots and source/demo links
- Use search to find components quickly
This repository contains two connected parts:
- Website and content app (Astro):
src/ - Flutter source app for previews:
flutter_apps/core/
In simple terms:
- The website renders content from Markdown.
- Widget pages embed the Flutter web app in an iframe.
- The iframe gets a
pathquery parameter and loads the matching Flutter screen.
- Node.js (LTS recommended)
pnpm(this repo usespnpm@10)- Flutter SDK (required for running/building widget previews)
pnpm installRun these in two terminals:
pnpm devpnpm run-appspnpm devstarts the Astro site.pnpm run-appsstarts the Flutter web app on port8989for live iframe previews.
If you run only pnpm dev, pages still load, but widget previews will not work in dev mode.
pnpm dev: start Astro dev serverpnpm run-apps: run Flutter core app in browser (--web-port 8989)pnpm build: build Astro sitepnpm build-apps: build Flutter web app(s) and copy output topublic/flutter_apps/*pnpm preview: preview built Astro outputpnpm deploy: build + deploy with Wranglerpnpm format: formatsrc/with Prettier
Content is powered by Astro collections in src/content.config.ts.
Location: src/content/widgets/**
Common frontmatter fields:
titledescriptionapp(currentlycore)path(Flutter route used by iframe, e.g./ecommerce/product_grid)previewSize(mobile,tablet,desktop)code_files(paths relative toflutter_apps/core/lib/)order,icon(for grouping/navigation)
Example:
---
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 slash).
Location: src/content/templates/**
Common frontmatter fields:
titledescriptiontype(micro-interaction,full-app,ui-kit,single-page,clone)heroImage,appImagesgithubUrl,demoUrl,youtubeVideoIdtags
- Widget pages are generated from
src/pages/widgets/[...slug].astro. - The page loads source code from
flutter_apps/<app>/lib/*based oncode_files. - The preview iframe points to:
- dev:
http://localhost:8989/?path=<widget-path>&theme=<theme> - production:
/flutter_apps/<app>/index.html?path=<widget-path>&theme=<theme>
- dev:
- Flutter route mapping lives in
flutter_apps/core/lib/main.dart(routesmap).
When adding a new widget, make sure:
- You add the Dart screen file.
- You register its
pathinflutter_apps/core/lib/main.dart. - You create/update the widget markdown entry with matching
pathandcode_files.
src/pages/: Astro routes (home, widgets, templates, search, OG image routes)src/components/: Astro/React UI components (header, sidebar, preview tabs, iframe)src/content/widgets/: widget metadata/contentsrc/content/templates/: template metadata/contentsrc/styles/global.css: global theme and component stylesflutter_apps/core/lib/: Flutter widget/template screens and route mappublic/flutter_apps/core/: built Flutter web output (generated)scripts/build.js: builds all Flutter apps and copies artifacts topublic/flutter_apps/
- Create Dart file(s) in
flutter_apps/core/lib/<category>/.... - Register route in
flutter_apps/core/lib/main.dart. - Create markdown entry in
src/content/widgets/<category>/<widget>.md. - If new category, add
src/content/widgets/<category>/index.md.
- Create
src/content/templates/<template>.md. - Add image assets in
src/assets/template_images/when needed. - Fill template frontmatter (
title,description,heroImage, links, tags, etc.).
- Ensure Markdown entries and Dart files match.
- Verify each
code_filespath exists. - Run
pnpm format. - Run
pnpm build. - If Flutter screens changed, run
pnpm build-appsand include generated updates when appropriate.
MIT