Skip to main content

flutter_a11y_check 0.1.0 copy "flutter_a11y_check: ^0.1.0" to clipboard
flutter_a11y_check: ^0.1.0 copied to clipboard

One-line accessibility audit for Flutter widget tests. Checks tap targets, labels, text contrast, images, 200% font size, duplicate labels and focus order, and prints a readable report (text, Markdown [...]

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flutter_localizations/flutter_localizations.dart';

import 'screens/bad_screen.dart';
import 'screens/good_screen.dart';

void main() => runApp(const ExampleApp());

/// Hosts a screen with English and Arabic (RTL) support.
class ExampleApp extends StatelessWidget {
  const ExampleApp({super.key, this.home});

  /// The screen to show. Defaults to a picker between the bad and the good screen.
  final Widget? home;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'a11y check example',
      supportedLocales: const <Locale>[Locale('en'), Locale('ar')],
      localizationsDelegates: GlobalMaterialLocalizations.delegates,
      home: home ?? const PickerScreen(),
    );
  }
}

class PickerScreen extends StatelessWidget {
  const PickerScreen({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(title: const Text('a11y check example')),
      body: ListView(
        children: <Widget>[
          ListTile(
            title: const Text('Inaccessible checkout'),
            onTap: () => Navigator.of(
              context,
            ).push(MaterialPageRoute<void>(builder: (_) => const BadScreen())),
          ),
          ListTile(
            title: const Text('Accessible checkout'),
            onTap: () => Navigator.of(
              context,
            ).push(MaterialPageRoute<void>(builder: (_) => const GoodScreen())),
          ),
        ],
      ),
    );
  }
}
0
likes
145
points
67
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

One-line accessibility audit for Flutter widget tests. Checks tap targets, labels, text contrast, images, 200% font size, duplicate labels and focus order, and prints a readable report (text, Markdown or JSON) instead of a terse matcher failure.

Repository (GitHub)
View/report issues

Topics

#accessibility #a11y #testing #widget-test #wcag

License

MIT (license)

Dependencies

flutter, flutter_test

More

Packages that depend on flutter_a11y_check