21

Why I did a accessibility analysis on flutter app getting message as follows:

This item may not have a label readable by screen readers.

enter image description here

My widget has this code:

Semantics(
  label: 'Login page.',
  child: Scaffold(
    backgroundColor: Colors.grey[900],
    body: Container(
      padding: EdgeInsets.all(25),
      child: Center(
        child: Text("My app!!!", style: labelTextStyle, semanticsLabel: 'app of semantic',)
      ),
    ),
  ),
);

How to fix this?

Piccaza De
  • 459
  • 5
  • 15

2 Answers2

2

Unfortunately, Accessibility Scanner doesn't work with Flutter apps yet, despite Google recommending it in official Flutter docs.

You can keep tabs on support for it via Flutter issue #39531.

Tin Man
  • 700
  • 8
  • 29
0

I work closely with a friend who is blind and uses screens readers to code and use his phone.

Using Semantics on top of an Scaffold would make the whole page to only say the label (in your case Login Page.) So the Accessibility Inspector is telling you that one of the labels (the Text's one) will not be readable by screens readers because the Semantics is over of it.

  • 1
    Even when there isn't a Semantics widget over it, Accessibility Scanner just does not seem to work for me, even though it's recommended in official documentation: https://docs.flutter.dev/development/accessibility-and-localization/accessibility. – Tin Man Sep 27 '22 at 14:10