labelFormatterCallback property Null safety

LabelFormatterCallback? labelFormatterCallback
final

Signature for formatting or changing the whole numeric or date label text.

  • The actual value without formatting is given by actualValue. It is either DateTime or double based on given values.
  • The formatted value based on the numeric or date format is given by formattedText.

This snippet shows how to set label format in SfRangeSlider.

SfRangeValues _values = SfRangeValues(100.0, 10000.0);

SfRangeSlider(
  min: 100.0,
  max: 10000.0,
  values: _values,
  interval: 9000.0,
  showLabels: true,
  showTicks: true,
  labelFormatterCallback: (dynamic actualValue, String formattedText) {
    return actualValue == 10000 ? '\$ $ formattedText +' : '\$ $ formattedText';
  },
  onChanged: (SfRangeValues newValues) {
    setState(() {
      _values = newValues;
    });
  },
)

Implementation

final LabelFormatterCallback? labelFormatterCallback;