flutter_accessibility_scanner 1.2.0 copy "flutter_accessibility_scanner: ^1.2.0" to clipboard
flutter_accessibility_scanner: ^1.2.0 copied to clipboard

Scan Flutter widget trees for WCAG 2.1 accessibility issues (missing labels, low contrast, small tap targets, focus) with fix hints and JSON reports.

1.2.0 #

Reports for CI. Backward compatible with 1.1.

  • AccessibilityReport.passes(failOn:): one-line severity gate for tests and CI (a failing expectation makes flutter test exit non-zero).
  • Richer JSON: schemaVersion, issuesByType and issuesByWcagCriterion counts; each issue also carries short rule and level names. toJson(pretty: true) writes indented, diff-friendly output.
  • AccessibilityReport.fromJson / fromMap and AccessibilityIssue.fromJson read reports back, e.g. to compare against a saved baseline.
  • AccessibilityReport.toMarkdown() for pull request comments and $GITHUB_STEP_SUMMARY; issueCountsByWcagCriterion.
  • README: "In CI" section with a GitHub Actions example and exit codes.

1.1.0 #

Accuracy, API and tooling overhaul. Source compatible with 1.0; scan results are more precise, so issue counts will change.

Detection #

  • Interactive elements are now found precisely from their gesture handlers (GestureDetector, InkWell, every Material button) instead of guessing from render-object type names, which removes most false positives from scroll views, pointer listeners and plain containers.
  • Missing labels: a control counts as named when it contains visible text or has a Semantics label, Tooltip, or Icon.semanticLabel, including through MergeSemantics (e.g. CheckboxListTile). Icon glyphs no longer count as a label.
  • New ImageLabelDetector: reports images without semanticLabel that are not marked excludeFromSemantics (WCAG 1.1.1).
  • Contrast: reads backgrounds from Container/ColoredBox, DecoratedBox, Material, Card and Scaffold, blends translucent layers and text colors, honours the text scale factor, uses the correct WCAG "large text" size (24 px, or 18.66 px bold), and checks icon glyphs against the 3:1 non-text threshold (WCAG 1.4.11).
  • Tap targets: accounts for the invisible 48x48 padding Material adds around small buttons; minimum size is configurable (TapTargetDetector(minimumSize: 44)).
  • Focus: only reports controls that genuinely cannot take keyboard focus (e.g. a bare GestureDetector); InkWell and buttons pass.
  • Offstage content (such as routes behind the current page) is skipped.

API #

  • AccessibilityScanner(detectors: [...]) runs a custom set of detectors, including your own AccessibilityDetector subclasses.
  • scan(context, minimumSeverity: ...) and scanRenderObject(root).
  • Issues are sorted most severe first and carry wcagCriterion and global screen bounds.
  • AccessibilityReport: hasIssues, issuesByType, issuesAtLeast, issuesOfType, toMap, scannedElements, scanDuration.
  • ColorContrastUtils: relativeLuminance, composite, wcagLevel, toHex; suggestBetterColor now always returns a passing color with the smallest change.
  • AccessibilityScannerWidget: outlines each issue on screen, lists issues with their WCAG criterion, adds onReport, scanner, minimumSeverity, showHighlights and overlayDuration, and no longer scans its own button.
  • AccessibilityFixerButton: adds tooltip, focusNode, autofocus and borderRadius; no longer inserts a redundant focus stop or stretches to fill its parent.
  • AccessibilityFixerText: backgroundColor now actually enforces AA contrast; long text is no longer truncated for screen readers. Adds textAlign, maxLines and overflow.
  • All detectors have const constructors.

Maintenance #

  • Removed debug print output from scans.
  • Migrated off deprecated Color APIs; requires Flutter 3.27+ / Dart 3.6+.
  • Fixed pubspec URLs, shortened the description and added topics.
  • Clean static analysis, full API docs, new tests, CI and automated publishing.

1.0.0 #

Initial Release #

  • ✨ Core Features

    • Automatic widget tree scanning for accessibility issues
    • WCAG 2.1 AA compliance checking
    • Real-time development scanning with visual feedback
    • JSON report generation with detailed issue metadata
  • πŸ” Issue Detection

    • Missing semantic labels and descriptions
    • Poor color contrast ratios (below 4.5:1 WCAG standard)
    • Tap targets smaller than 48x48 logical pixels
    • Missing keyboard focus support
  • πŸ› οΈ Developer Tools

    • AccessibilityScanner - Main scanning engine
    • AccessibilityScannerWidget - Real-time development overlay
    • AccessibilityFixerButton - Helper widget for accessible buttons
    • AccessibilityFixerText - Helper widget for accessible text
    • ColorContrastUtils - WCAG color contrast calculations
  • πŸ“Š Reporting

    • Detailed accessibility reports with severity levels
    • JSON export functionality
    • Issue grouping by severity (Critical, High, Medium, Low)
    • Actionable suggestions for each detected issue
  • πŸ§ͺ Testing Integration

    • Widget test compatibility
    • Comprehensive test suite with 16 passing tests
    • Integration test examples
  • πŸ“š Documentation

    • Complete API documentation
    • Beginner-friendly examples
    • WCAG 2.1 guidelines mapping
    • Best practices guide
7
likes
160
points
15.5k
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Scan Flutter widget trees for WCAG 2.1 accessibility issues (missing labels, low contrast, small tap targets, focus) with fix hints and JSON reports.

Repository (GitHub)
View/report issues

Topics

#accessibility #a11y #wcag #semantics #testing

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_accessibility_scanner