Accessibility value on Flutter
An accessibility value helps users of assistive technologies to understand the state of elements on the screen. A slider should indicate the currently selected value, and ideally also it's minimum and maximum value. The screen reader announces the value of elements as it reads the screen. It is important to assign correct values to elements to avoid misunderstanding.
With Flutter, you can set an accessibility value by using the value
or attributedValue
property of Semantics
.
When using the semantically correct element, you usually do not need to modify the accessibility value. For example, Slider
, Switch
and CheckBox
, and others automatically assign accessibiluty values.
It is also possible to set an increasedValue
and decreasedValue
or attributedDecreasedValue
and attributedIncreasedValue
to indicate what the value will become when the user decreases or increases the value.
Some widgets include additional methods, such as semanticFormatterCallback
.
Semantics(
value: 'Custom',
increasedValue: 'Custom + 1',
decreasedValue: 'Custom - 1',
child: Widget(),
);