labelFormatterCallback property

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

This snippet shows how to set label format in SfRangeSelector.

SfRangeValues _initialValues = SfRangeValues(100.0, 10000.0);

SfRangeSelector(
  min: 100.0,
  max: 10000.0,
  initialValues: _initialValues,
  interval: 9000.0,
  showLabels: true,
  showTicks: true,
  labelFormatterCallback: (dynamic actualValue, String formattedText) {
    return actualValue == 10000 ? '\$ $ formattedText +' : '\$ $ formattedText';
  },
  child: Container(
      height: 200,
      color: Colors.green[100],
  ),
)

Implementation

final LabelFormatterCallback? labelFormatterCallback;