flutter-add-widget-preview
Skill by flutter
Adds interactive widget previews to a Flutter project using the previews.dart system. Intended for developers creating new UI components or updating existing screens who want consistent design and interactive testing.
Install flutter-add-widget-preview
Built from the published package, never by AI.
git clone --depth 1 https://github.com/flutter/agent-plugins /tmp/agent-plugins && mkdir -p ~/.claude/skills && cp -r /tmp/agent-plugins/skills/flutter-add-widget-preview ~/.claude/skills/flutter-add-widget-previewRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
Step-by-step: install flutter-add-widget-preview in Claude Code
git clone --depth 1 https://github.com/flutter/agent-plugins /tmp/agent-plugins && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/agent-plugins/skills/flutter-add-widget-preview ~/.gemini/antigravity-cli/skills/flutter-add-widget-previewAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install flutter-add-widget-preview in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill guides an AI assistant to add Flutter widget previews using the @Preview annotation from package:flutter/widget_previews.dart. The Flutter Widget Previewer renders marked widgets in real time, isolated from the full application. Targets can be top-level functions, static methods, or public widget constructors with no required arguments that return a Widget or WidgetBuilder.
The skill covers preview parameters such as name, group, size, theme, brightness and localizations. It also explains how to create custom Preview or MultiPreview classes to share configuration across widgets, and how to transform preview settings at runtime. It describes how to launch the previewer from a supported IDE or the command line, and how to use hot restart while iterating. It is aimed at Flutter developers who build or update UI components.
Written from the project's SKILL.md and checked against it.
What it can do
- Apply @Preview annotationsMarks top-level functions, static methods or parameterless widget constructors as previewable targets.
- Configure preview parametersSets name, group, size, textScaleFactor, wrapper, theme, brightness and localizations for a preview.
- Create multiple previewsApplies several @Preview annotations to one target or extends MultiPreview to generate several previews.
- Build custom preview annotationsExtends the Preview class to inject shared themes, wrappers or sizes across multiple widgets.
- Transform previews at runtimeOverrides transform() to change preview names or settings dynamically.
- Launch the Widget PreviewerStarts the previewer from a supported IDE or with the flutter widget-preview start command.
- Iterate with hot restartUses global or per-preview hot restart after changing code or preview configuration.
What you need
- Flutter SDK
- Flutter 3.47 or later for IDE preview support in VS Code
- Android Studio, IntelliJ or VS Code for the IDE workflow
- Chrome for the command line workflow
Try asking
- Add a widget preview for my new SubmitButton component
- Create light and dark previews for my Card widget
- Wrap my settings screen in a themed preview with a dark brightness
Good to know
- Previews run in a web environment, so dart:io and dart:ffi APIs are not supported
- Unconstrained widgets default to roughly half the viewport unless a size is set
- Callback arguments passed to preview annotations must be public and constant
- Build cache is stored in the .widget_preview/ folder in the project root
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/flutter-add-widget-preview/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md8 KB
Alternatives to flutter-add-widget-preview
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
flutter-add-widget-preview: common questions
What widgets can be previewed with @Preview?
The annotation can target top-level functions, static methods within a class, or public widget constructors that have no required arguments and return a Widget or WidgetBuilder.
Can previews use native plugins or dart:io?
No. The source says the previewer runs in a web environment and that widgets with transitive dependencies on dart:io or dart:ffi will throw exceptions. It suggests conditional imports or wrappers to bypass them in preview mode.
How do I update a preview after changing code?
The previewer updates automatically. If global state changed, use the global hot restart button at the bottom right. If only local widget state needs resetting, use the hot restart button on that preview card.
How do I install flutter-add-widget-preview?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is flutter-add-widget-preview free?
The code is published under the BSD-3-Clause licence. The service it connects to may have its own pricing.
Is flutter-add-widget-preview safe to use?
It scores 91 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to flutter-add-widget-preview?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
