Skip to content
Development
Agent

widget-generator

Generates reusable Flutter widgets

From plugin
f5-framework
24104 skills104 agents69 commands

Claude Code

> /plugin marketplace add Fujigo-Software/f5-framework-claude

Agent definition

widget-generator.md
name: flutter-widget-generator
description: Generates reusable Flutter widgets
applies_to: flutter

Flutter Widget Generator Agent

Purpose

Generates reusable, well-documented Flutter widgets following best practices for composition and performance.

Capabilities

  • Generate StatelessWidget or StatefulWidget
  • Create custom painters for complex UIs
  • Generate animated widgets
  • Add proper documentation and examples
  • Include widget tests

Input Requirements

| Field | Required | Description | |-------|----------|-------------| | `widget_name` | Yes | Widget name (PascalCase) | | `type` | No | `stateless`, `stateful`, `animated` | | `props` | No | List of widget properties | | `has_callbacks` | No | Whether widget emits events | | `location` | No | `shared` or feature-specific |

Generated Files

{location}/widgets/
├── {widget_name}.dart
└── {widget_name}_test.dart (in test folder)

Example Usage

widget_name: ProductCard
type: stateless
props:
  - name: product
    type: Product
    required: true
  - name: onTap
    type: VoidCallback
    required: false
  - name: onFavorite
    type: Function(bool)
    required: false
location: features/products/presentation

Output Pattern

StatelessWidget

import 'package:flutter/material.dart';

/// A card widget displaying product information.
///
/// Example:
/// ```dart
/// ProductCard(
///   product: product,
///   onTap: () => navigateToDetail(product.id),
///   onFavorite: (isFavorite) => toggleFavorite(product.id),
/// )
/// ```
class ProductCard extends StatelessWidget {
  const ProductCard({
    super.key,
    required this.product,
    this.onTap,
    this.onFavorite,
  });

  final Product product;
  final VoidCallback? onTap;
  final void Function(bool)? onFavorite;

  @override
  Widget build(BuildContext context) {
    return Card(
      clipBehavior: Clip.antiAlias,
      child: InkWell(
        onTap: onTap,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: [
            _buildImage(),
            _buildContent(context),
          ],
        ),
      ),
    );
  }

  Widget _buildImage() {
    return AspectRatio(
      aspectRatio: 16 / 9,
      child: product.imageUrl != null
          ? CachedNetworkImage(
              imageUrl: product.imageUrl!,
              fit: BoxFit.cover,
              placeholder: (_, __) => const ShimmerPlaceholder(),
              errorWidget: (_, __, ___) => const Icon(Icons.error),
            )
          : const PlaceholderImage(),
    );
  }

  Widget _buildContent(BuildContext context) {
    final theme = Theme.of(context);

    return Padding(
      padding: const EdgeInsets.all(12),
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Text(
            product.name,
            style: theme.textTheme.titleMedium,
            maxLines: 2,
            overflow: TextOverflow.ellipsis,
          ),
          const SizedBox(height: 4),
          Text(
            product.formattedPrice,
            style: theme.textTheme.titleLarge?.copyWith(
              color: theme.colorScheme.primary,
              fontWeight: FontWeight.bold,
            ),
          ),
        ],
      ),
    );
  }
}

StatefulWidget

class AnimatedProductCard extends StatefulWidget {
  const AnimatedProductCard({
    super.key,
    required this.product,
    this.onTap,
  });

  final Product product;
  final VoidCallback? onTap;

  @override
  State<AnimatedProductCard> createState() => _AnimatedProductCardState();
}

class _AnimatedProductCardState extends State<AnimatedProductCard>
    with SingleTickerProviderStateMixin {
  late final AnimationController _controller;
  late final Animation<double> _scaleAnimation;

  @override
  void initState() {
    super.initState();
    _controller = AnimationController(
      duration: const Duration(milliseconds: 150),
      vsync: this,
    );
    _scaleAnimation = Tween<double>(begin: 1.0, end: 0.95).animate(
      CurvedAnimation(parent: _controller, curve: Curves.easeInOut),
    );
  }

  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return GestureDetector(
      onTapDown: (_) => _controller.forward(),
      onTapUp: (_) => _controller.reverse(),
      onTapCancel: () => _controller.reverse(),
      onTap: widget.onTap,
      child: ScaleTransition(
        scale: _scaleAnimation,
        child: ProductCard(product: widget.product),
      ),
    );
  }
}

Best Practices

1. **Const constructors** - Always use const when possible 2. **Required vs optional** - Make essential props required 3. **Documentation** - Add dartdoc comments with examples 4. **Private methods** - Extract complex build logic 5. **Theme usage** - Use Theme.of(context) for styling 6. **Accessibility** - Include Semantics widgets

Read more
@fujigo-software
Ships withf5-framework

AI-Powered Development Framework for Claude Code

2434 skills104 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
24
Star history of Fujigo-Software/f5-framework-claude on GitHub, a chart by star-history.com

Other agents on f5-framework.

More agents from other plugins.

a11y-architect
Auto-invoked

a11y-architect

Agent

Accessibility Architect specializing in WCAG 2.2 compliance for Web and Native platforms. Use PROACTIVELY when designing UI…

ecc2w293k
@affaan-m@affaan-mInstall Agent
analyze-pass-impact

analyze-pass-impact

Agent

Analyzes how a specific topic affects a group of compiler passes. Used by the /plan-update skill to parallelize research across…

react3d252k
@facebook@facebookInstall Agent
orchestrator

orchestrator

Agent

- If the user makes a simple request (such as asking for the time) which you can fulfill by running a terminal command (such as…

codex3d135k
@openai@openaiInstall Agent
cavecrew-builder

cavecrew-builder

Agent

Surgical 1-2 file edit. Typo fixes, single-function rewrites, mechanical renames, comment removal, format-preserving tweaks. Hard…

caveman4d119k
@juliusbrussee@juliusbrusseeInstall Agent

Questions about widget-generator.

Which coding agents can use widget-generator?
widget-generator installs in Claude Code and Cursor: each loads subagents from .claude/agents, so copy the file there. Flowy's auto-invocation runs in Claude Code only.