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 value.
  • The formatted value based on the numeric or date format is given by formattedText.

This snippet shows how to set label format in SfSlider.

double _value = 10000.0;

SfSlider(
  min: 100.0,
  max: 10000.0,
  value: _value,
  interval: 9000.0,
  showLabels: true,
  showTicks: true,
  labelFormatterCallback: (dynamic actualValue, String formattedText) {
    return actualValue == 10000 ? '\$ $ formattedText +' : '\$ $ formattedText';
  },
  onChanged: (dynamic newValue) {
    setState(() {
      _value = newValue;
    });
  },
)

Implementation

final LabelFormatterCallback? labelFormatterCallback;