Skip to content
Back to skills

Flutter Widgets

ASecurity

Build maintainable Flutter UI components with composition and theming. Use when changing widget implementation; defer animation-only changes and widget-test authoring.

  • 24 stars
  • 0 votes
  • 4 copies
  • 12 views
  • Added September 4, 2026
designtestingperformance

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 4, 2026

npx -y skills add gabrielmoreira/agent-skills-mirror --skill flutter-widgets --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Flutter Widgets?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Flutter Widgets
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/gabrielmoreira-flutter-widgets/badge)](https://www.skillsdirectory.com/skills/gabrielmoreira-flutter-widgets)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: flutter-widgets
description: Build maintainable Flutter UI components with composition and theming. Use when changing widget implementation; defer animation-only changes and widget-test authoring.
metadata:
  triggers:
    files:
    - '**_page.dart'
    - '**_screen.dart'
    - '**/widgets/**'
    keywords:
    - StatelessWidget
    - const
    - Theme
    - ListView
---
# UI & Widgets

## **Priority: P1 (HIGH)**


- **State**: Use `StatelessWidget` by default. `StatefulWidget` only for local state/controllers.
- **Composition**: Extract UI into small, atomic `const` widgets.
- **Theming**: Use `Theme.of(context)`. No hardcoded colors.
- **Layout**: Use `Flex` + `Gap/SizedBox`.
- **Widget Keys**: All interactive elements must use keys from `widget_keys.dart`.
- **File Size**: If UI file exceeds ~80 lines, extract sub-widgets into private classes.
- **Specialized**:
 - `SelectionArea`: For multi-widget text selection.
 - `InteractiveViewer`: For zoom/pan.
 - `ListWheelScrollView`: For pickers.
 - `IntrinsicWidth/Height`: Avoid unless strictly required.
- **Large Lists**: Always use `ListView.builder`.

```dart
class AppButton extends StatelessWidget {
  final String label;
  final VoidCallback onPressed;
  const AppButton({super.key, required this.label, required this.onPressed});

  @override
  Widget build(BuildContext context) => ElevatedButton(onPressed: onPressed, child: Text(label));
}
```

## Anti-Patterns

- **No setState for server state**: Server or shared state belongs in BLoC, not widget state.
- **No widget file over 80 lines without extraction**: Extract sub-widgets into private classes.
- **No inline Key strings**: All keys must constants defined in `widget_keys.dart`.
- **No \_buildXxx() helper methods**: Extract to `const StatelessWidget` private class.
- **No manual widget repetition**: When 3+ sibling widgets of the same type differ only in data (e.g., radio buttons, tabs), map over a list instead. Put display labels inside the value object or a companion map so adding an option requires no UI change.

## References

- performance | testing

## Canonical response anchors

When this skill applies, preserve the following domain terminology or equivalent concrete examples in the answer when relevant:
- Extract
- interactive elements
- into private

Files in this skill

  • SKILL.md2.3 KB
  • evals/evals.json2 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in design →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.