Token导航 LogoToken导航TokenDH.com
前端设计需要联网github未标认证来源可访问许可证需确认审计通过

flutter-accessibilityFlutter 无障碍

Agent Skill

用于辅助无障碍访问检查、页面可用性审计和前端可访问性改进。它适合让 Agent 检查语义标签、键盘操作、颜色对比、ARIA 属性和自动化检测结果。使用时需要结合真实页面和浏览器验证,不应只依赖静态文本判断;涉及修复建议时,应兼顾设计系统、组件复用和 WCAG 等通用无障碍规范。

总安装

24,088

周安装

984

GitHub Stars

1,316

下载量

7,715
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:flutter-accessibility(Flutter 无障碍)
来源仓库:https://github.com/flutter/skills
仓库路径:skills/flutter-accessibility
安装命令:
npx skills add https://github.com/flutter/skills --skill flutter-accessibility
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/flutter/skills --skill flutter-accessibility

简介

在 Flutter 应用程序中实施 WCAG 2 和 EN 301 549 辅助功能标准和自适应布局。

  • 在移动、Web 和桌面平台上强制执行语义注释、点击目标尺寸(最小 48x48 dp)和文本对比度(小文本为 4.5:1,大文本为 3:1)
  • 为 Web 语义初始化、交互式小部件包装、基于屏幕尺寸的布局切换以及键盘/鼠标输入处理提供决策逻辑
  • 包括通过 FocusTraversalGroup 进行焦点遍历管理
  • 和 FocusableActionDetector
  • 对于逻辑选项卡顺序和悬停状态
  • 提供自动辅助功能测试指南,以验证是否符合 androidTapTargetGuideline, iOSTapTargetGuideline
  • 和文本对比指导线
  • 禁止硬件类型检查和方向锁定;需要布局构建器
  • 和 MediaQuery.sizeOf()
  • 用于响应式设计

SKILL.md

flutter-accessibility-and-adaptive-design

Goal

Implements, audits, and enforces accessibility (a11y) and adaptive design standards in Flutter applications. Ensures compliance with WCAG 2 and EN 301 549 by applying proper semantic roles, contrast ratios, tap target sizes, and assistive technology integrations. Constructs adaptive layouts that respond to available screen space and input modalities (touch, mouse, keyboard) without relying on hardware-specific checks or locked orientations.

Decision Logic

When implementing UI components, follow this decision tree to determine the required accessibility and adaptive design implementations:

  1. Is the app targeting Flutter Web?

- Yes: Ensure SemanticsBinding.instance.ensureSemantics(); is called at startup. Explicitly map custom widgets to SemanticsRole to generate correct ARIA tags. - No: Proceed to standard mobile/desktop semantics.

  1. Is the widget interactive?

- Yes: Wrap in Semantics with button: true or appropriate role. Ensure tap target is $\ge$ 48x48 logical pixels. - No: Ensure text contrast meets WCAG standards (4.5:1 for small text, 3.0:1 for large text).

  1. Does the layout need to change based on screen size?

- Yes: Use LayoutBuilder or MediaQuery.sizeOf(context). Do NOT use MediaQuery.orientation or hardware type checks (e.g., isTablet). - No: Use standard flexible widgets (Expanded, Flexible) to fill available space.

  1. Does the app support desktop/web input?

- Yes: Implement FocusableActionDetector, Shortcuts, and MouseRegion for hover states and keyboard traversal. - No: Focus primarily on touch targets and screen reader traversal order.

Instructions

  1. Initialize Web Accessibility (If Applicable) For web targets, accessibility is disabled by default for performance. Force enable it at the entry point. import 'package:flutter/foundation.dart'; import 'package:flutter/semantics.dart'; void main() {runApp(const MyApp()); if (kIsWeb) {SemanticsBinding.instance.ensureSemantics();}}
  2. Apply Semantic Annotations Use Semantics, MergeSemantics, and ExcludeSemantics to build a clean accessibility tree. For custom web components, explicitly define the SemanticsRole. Semantics(role: SemanticsRole.button, label: 'Submit Form', hint: 'Press to send your application', button: true, child: GestureDetector(onTap: _submit, child: const CustomButtonUI(),),)
  3. Enforce Tap Target and Contrast Standards Ensure all interactive elements meet the 48x48 dp minimum (Android) or 44x44 pt minimum (iOS/Web). // Example of enforcing minimum tap target size ConstrainedBox(constraints: const BoxConstraints(minWidth: 48.0, minHeight: 48.0,), child: IconButton(icon: const Icon(Icons.info), onPressed: () {}, tooltip: 'Information', // Tooltip.message follows Tooltip.child in semantics tree),)
  4. Implement Adaptive Layouts Use LayoutBuilder to respond to available space rather than device type. LayoutBuilder(builder: (context, constraints) {if (constraints.maxWidth > 600) {return const WideDesktopLayout();} else {return const NarrowMobileLayout();}},)
  5. Implement Keyboard and Mouse Support Use FocusableActionDetector for custom controls to handle focus, hover, and keyboard shortcuts simultaneously. FocusableActionDetector(onFocusChange: (hasFocus) => setState(() => _hasFocus = hasFocus), onShowHoverHighlight: (hasHover) => setState(() => _hasHover = hasHover), actions: <Type, Action<Intent>>{ActivateIntent: CallbackAction<Intent>(onInvoke: (intent) {_performAction(); return null;},),}, child: MouseRegion(cursor: SystemMouseCursors.click, child: CustomWidget(isHovered: _hasHover, isFocused: _hasFocus),),)
  6. Manage Focus Traversal Group related widgets using FocusTraversalGroup to ensure logical tab order for keyboard users. FocusTraversalGroup(policy: OrderedTraversalPolicy(), child: Column(children: [FocusTraversalOrder(order: const NumericFocusOrder(1.0), child: TextField(),), FocusTraversalOrder(order: const NumericFocusOrder(2.0), child: ElevatedButton(onPressed: () {}, child: Text('Submit')),),],),)
  7. Validate Accessibility via Automated Tests STOP AND ASK THE USER: "Would you like me to generate widget tests to validate accessibility guidelines (contrast, tap targets) for your UI?" If yes, implement the AccessibilityGuideline API in the test suite: import 'package:flutter_test/flutter_test.dart'; void main() {testWidgets('Validates a11y guidelines', (WidgetTester tester) async {final SemanticsHandle handle = tester.ensureSemantics(); await tester.pumpWidget(const MyApp()); await expectLater(tester, meetsGuideline(androidTapTargetGuideline)); await expectLater(tester, meetsGuideline(iOSTapTargetGuideline)); await expectLater(tester, meetsGuideline(labeledTapTargetGuideline)); await expectLater(tester, meetsGuideline(textContrastGuideline)); handle.dispose();});}

Constraints

  • Never lock device orientation. Apps must support both portrait and landscape modes to comply with accessibility standards.
  • Never use hardware type checks (e.g., checking if the device is a phone or tablet) for layout decisions. Always use MediaQuery.sizeOf or LayoutBuilder.
  • Never use MediaQuery.orientation near the top of the widget tree to switch layouts. Rely on available width/height breakpoints.
  • Always provide Semantics labels for custom interactive widgets or images that convey meaning.
  • Always use PageStorageKey on scrollable lists that do not change layout during orientation shifts to preserve scroll state.
  • Do not consume infinite horizontal space for text fields or lists on large screens; constrain maximum widths for readability.
  • Account for Tooltip semantics order: Tooltip.message is visited immediately *after* Tooltip.child in the semantics tree. Update tests accordingly.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

36.31%
按下载量换算2,801

Claude

31.17%
按下载量换算2,405

Cursor

17.39%
按下载量换算1,342

Gemini CLI

8.73%
按下载量换算674

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills