semanticFormatterCallback property

SemanticFormatterCallback? semanticFormatterCallback
final

The callback used to create a semantic value from the slider's values.

Defaults to formatting values as a percentage.

This is used by accessibility frameworks like TalkBack on Android to inform users what the currently selected value is with more context.

In the example below, a slider for currency values is configured to announce a value with a currency label.
link
RangeSlider(
  values: _dollarsRange,
  min: 20.0,
  max: 330.0,
  onChanged: (RangeValues newValues) {
    setState(() {
      _dollarsRange = newValues;
    });
  },
  semanticFormatterCallback: (double newValue) {
    return '${newValue.round()} dollars';
  }
 )

Implementation

final SemanticFormatterCallback? semanticFormatterCallback;