tooltipTextFormatterCallback property Null safety

TooltipTextFormatterCallback? tooltipTextFormatterCallback
final

Signature for formatting or changing the whole tooltip 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 tooltip format in SfSlider.

DateTime _value = DateTime(2010, 01, 01, 13, 00, 00);

SfSlider(
  min: DateTime(2010, 01, 01, 9, 00, 00),
  max: DateTime(2010, 01, 01, 21, 05, 00),
  value: _value,
  interval: 4,
  showLabels: true,
  enableTooltip: true,
  dateFormat: DateFormat('h a'),
  dateIntervalType: DateIntervalType.hours,
  tooltipTextFormatterCallback:
      (dynamic actualValue, String formattedText) {
    return DateFormat('h:mm a').format(actualValue);
  },
  onChanged: (dynamic newValue) {
    setState(() {
      _value = newValue;
    });
  },
)

Implementation

final TooltipTextFormatterCallback? tooltipTextFormatterCallback;