Coder Social home page Coder Social logo

phcs971 / accessibility_tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rebelappstudio/accessibility_tools

0.0 0.0 0.0 1.17 MB

License: MIT License

C++ 10.59% C 0.72% Objective-C 0.02% Kotlin 0.06% Dart 77.91% Swift 0.59% HTML 0.92% CMake 9.18%

accessibility_tools's Introduction

Rebel App Studio logo

accessibility_tools

Checkers and tools to ensure your app is accessible to all.

Creating an accessible app is incredibly important. But too often it's forgotten about, or left to later. This package ensures your app is accessible from day one, by checking your interface as you build it.

A screenshot showing an icon with two failed accessibility checks: the tooltip reads "Tap area is missing a semantic label" and "Tap area of 40x40 is too small: should be at least 48ร—48"

To show the issue tooltip, hover over the widget or long-press it.

Tap wrench icon to open testing tools panel:

A screenshot of testing tools panel with a list of toggles that developers can use to check how their app works with various settings: text scale, localization, text direction, color mode simulation

From Rebel App Studio

pub License: MIT codecov

Getting Started

Add AccessibilityTools to your app's builder property:

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // *** Add the line below ***
      builder: (context, child) => AccessibilityTools(child: child),
      home: HomePage(),
    );
  }
}

The tools only run in debug mode, and are compiled out of release builds.

Current accessibility checkers

Semantic label checker

Ensures buttons (and other tappable widgets) have an associated semantic label.

For example, this icon button is missing a label:

IconButton(
  onPressed: () => login(),
  icon: Icon(Icons.person),
)

Adding a semantic label would fix this: Icon(Icons.person, semanticLabel: 'Login').

Tap area checker

Makes sure all tappable widgets are large enough to easily tap. Defaults to the Material Design minimum of 48x48 on mobile devices, and 44x44 on desktop devices.

Large font overflow checker

Experimental: ensures that no flex widgets, such as Column and Row, overflow when a user is using larger font sizes. This checker is experimental, and disabled by default, and can be enabled via AccessibilityTools(checkFontOverflows: true).

Input label checker

Makes sure text fields (TextField, TextFormField, Autocomplete etc) and inputs (Checkbox, Radio, Switch etc) have semantic labels.

Image label checker

Makes sure images have semantic labels.

Current testing tools toggles

  • Text scale. Changes text scale factor, range is 0.1 to 10.0. Does nothing if app ignores text scaling
  • Localization. Overrides current selected locale of a WidgetApp
  • Text direction. Forces text to be displayed according to the selected values (right-to-left or left-to-right)
  • Platform. Changes current TargetPlatform. This may change scrolling behavior, back button icon, gesture navigation etc
  • Density. Changes app's visual density. This may change padding of some widgets (e.g. ListTile)
  • Bold text. Simulates operating system's request to make text bolder
  • Color mode simulation. Simulates a color mode. Supported modes: protanopia, deuteranopia, tritanopia, inverted colors, grayscale
  • Screen reader mode. Enables semantics debugger to simulate how app is seen by screen readers

Configuration

Checkers are enabled or disabled with properties on the AccessibilityTools widget:

AccessibilityTools(
  // Set to null to disable tap area checking
  minimumTapAreas: MinimumTapAreas.material,
  // Check for semantic labels
  checkSemanticLabels: false,
  // Check for flex overflows
  checkFontOverflows: true,
  // Check for image labels
  checkImageLabels: true,
  // Set how much info about issues is printed
  logLevel: LogLevel.verbose,
  // Set where the buttons are placed
  buttonsAlignment: ButtonsAlignment.bottomRight,
  // Enable or disable draging the buttons around
  enableButtonsDrag: false,
  child: child,
)

accessibility_tools's People

Contributors

tomgilder avatar aednlaxer avatar phcs971 avatar nilsreichardt avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.