金色时刻 · 15:48
让好资源,触手可及
AGENT SKILL

widgets

widgets 是面向软件开发的 Agent Skill,来自 HoangNguyen0403/agent-skills-standard。查看技能说明、操作步骤与使用约定,并通过原项目了解详细用法。

Principles for maintainable UI components.

SKILL.md

下载 MD ↓
nameFlutter UI Widgets
descriptionPrinciples for maintainable UI components.
metadata{"labels": ["ui", "widgets"], "triggers": {"files": ["**_page.dart", "**_screen.dart", "**/widgets/**"], "keywords": ["StatelessWidget", "const", "Theme", "ListView"]}}

UI & Widgets

Priority: P1 (OPERATIONAL)

Standards for building reusable, performant Flutter widgets and UI components.

  • 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.
  • 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.
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));
}

Related Topics

performance | testing

来源:HoangNguyen0403/agent-skills-standard · MIT 许可 · 许可原文 · MD 为来源页保存的历史版本