Flutter Accessibility Basics

Accessibility means building apps that everyone can use, including people who are blind, have low vision, have limited movement, or use a screen reader. Roughly one in six people worldwide lives with some form of disability. Accessible design helps people in bright sunlight, noisy rooms, or one-handed situations. Good accessibility improves the app for every user.

How Screen Readers Work

TalkBack on Android and VoiceOver on iOS read the screen aloud. Users swipe through elements one at a time, and the reader announces each element's name and role. Flutter builds a hidden tree of this information called the semantics tree, which runs alongside the widget tree.


  Widget tree                 Semantics tree (what the reader hears)
  ──────────                  ──────────────────────────────────────
  Scaffold                    Screen
  └── Column                  ├── "Welcome", heading
      ├── Text                ├── "Email", text field
      ├── TextField           └── "Sign in", button
      └── ElevatedButton

Standard widgets such as Text, ElevatedButton, and TextField provide semantics automatically. Custom drawings and image-only buttons need your help.

The Semantics Widget

Wrap a widget in Semantics to describe it to assistive technology.


Semantics(
  label: 'Add item to cart',
  button: true,
  child: GestureDetector(
    onTap: addToCart,
    child: Icon(Icons.add_shopping_cart),
  ),
)

Without the label, a screen reader says "unlabeled button", which tells users nothing.

Labels for Images and Icons

Decorative pictures need no description, and meaningful pictures need one.


Image.asset('assets/images/chart.png', semanticLabel: 'Sales rose 20 percent in March')

Icon(Icons.favorite, semanticLabel: 'Favorite')

IconButton(
  icon: Icon(Icons.delete),
  tooltip: 'Delete message',
  onPressed: deleteMessage,
)

The tooltip on an IconButton doubles as the screen-reader label and as a hint for mouse users.

Hiding Noise

Some elements add clutter, such as a decorative divider. Hide them from the reader with ExcludeSemantics. Merge several widgets into one announcement with MergeSemantics, so a label and its value read as a single phrase.

Touch Target Size

Small buttons frustrate people with limited dexterity. Material guidelines recommend at least 48 by 48 logical pixels for any tappable item.


  Too small (24 px)        Comfortable (48 px)
  ┌──┐                     ┌──────┐
  └──┘                     │      │
                           └──────┘

Flutter's built-in buttons already meet this size. Wrap custom tappable items in SizedBox or add padding to reach the minimum.

Color Contrast

Text must stand out from its background. The Web Content Accessibility Guidelines set a minimum ratio of 4.5 to 1 for normal text and 3 to 1 for large text. Light gray on white fails this test, however stylish it looks.

CombinationReadable?
Dark navy on whiteYes
White on medium blueYes
Light gray on whiteNo
Yellow on whiteNo

Never rely on color alone to carry meaning. A red border on an invalid field helps nobody who cannot see red. Add an error icon and a text message.

Text Scaling

Users enlarge system fonts in device settings. Layouts must survive larger text. Avoid fixed-height containers around text, use Flexible or Expanded, and let content scroll when space runs out. Test by setting the system font to its largest size.

Focus and Keyboard Navigation

Some users navigate with a keyboard or switch device. Interactive widgets receive focus in reading order by default. Wrap a group in FocusTraversalGroup when the visual order differs from the code order, and make sure every action offers a focus indicator.

Motion and Timing

Fast flashing and heavy animation cause discomfort for some users. Read MediaQuery.of(context).disableAnimations and skip decorative animation when it is true. Give messages enough time on screen, and let users dismiss them manually.

Testing Accessibility

  • Turn on TalkBack or VoiceOver and navigate your app with your eyes closed.
  • Enlarge the system font and check each screen for overflow.
  • Run the built-in guideline checks in a widget test:

testWidgets('meets tap target guidelines', (tester) async {
  final handle = tester.ensureSemantics();
  await tester.pumpWidget(MyApp());
  await expectLater(tester, meetsGuideline(androidTapTargetGuideline));
  await expectLater(tester, meetsGuideline(labeledTapTargetGuideline));
  handle.dispose();
});

The Accessibility Scanner app for Android and the Accessibility Inspector in Xcode give extra reports.

Practice Ideas

Take one screen from your own app and run it through a screen reader. Write down every element that sounds confusing, add labels, and test again. Compare the screen at normal text size and at maximum text size.