flutter-add-widget-preview

Configure Flutter Widget Previewer with @Preview annotations for isolated UI rendering.

2.8k|166|Updated Feb 25, 2026
One-click install
npx skills add https://github.com/flutter/agent-plugins --skill flutter-add-widget-preview-flutter
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: flutter-add-widget-preview
Source: https://github.com/flutter/agent-plugins/tree/main/skills/flutter-add-widget-preview
Command: npx skills add https://github.com/flutter/agent-plugins --skill flutter-add-widget-preview-flutter

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill addresses the difficulty of testing UI components within a full application context by enabling real-time, isolated rendering of Flutter widgets.

Core Features & Use Cases

  • Isolated Rendering: Apply the @Preview annotation to widgets to view them independently of the main app state.
  • Custom Configurations: Support for custom themes, multi-preview instances, and runtime transformations to simulate various UI states.
  • Use Case: When developing a complex design system, use this skill to verify button variants, typography, and card layouts across light and dark modes without needing to navigate through the entire application flow.

Quick Start

Use the flutter-add-widget-preview skill to generate a new preview for the current widget file.

Frequently Asked Questions about flutter-add-widget-preview

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I preview Flutter widgets in isolation during UI development?

You can preview Flutter widgets in isolation by applying the @Preview annotation to top-level functions or constructors, enabling the widget_previews system to render components independently of the main app state.

What is the best way to test Flutter UI components across light and dark modes?

Testing Flutter UI components across light and dark modes is achieved by configuring custom themes and runtime transformations within the widget previewer to simulate various UI states without full app navigation.

Can I render multiple preview instances for a single Flutter widget?

Yes, you can render multiple preview instances for a single Flutter widget by generating custom preview configurations that support multi-preview setups and apply runtime transformations.

What constraints apply when using the Flutter widget_previews system?

The Flutter widget_previews system enforces strict constraints, requiring public callbacks and specific compatibility rules for top-level functions and constructors to render UI components correctly.

Why does my Flutter widget preview fail to render in isolation?

Your Flutter widget preview likely fails to render due to unmet compatibility constraints, such as missing public callback requirements or improper application of the @Preview annotation to constructors.

Does the Flutter Widget Previewer support custom theme configurations?

Yes, the Flutter Widget Previewer supports custom theme configurations, allowing you to verify button variants, typography, and layouts across different visual states during rapid design iteration.