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

This snippet shows how to set tooltip format in SfRangeSlider.

SfRangeValues _values = SfRangeValues(
     DateTime(2010, 01, 01, 13, 00, 00),
     DateTime(2010, 01, 01, 17, 00, 00));

SfRangeSlider(
  min: DateTime(2010, 01, 01, 9, 00, 00),
  max: DateTime(2010, 01, 01, 21, 05, 00),
  values: _values,
  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: (SfRangeValues newValues) {
    setState(() {
      _values = newValues;
    });
  },
)

Implementation

final TooltipTextFormatterCallback? tooltipTextFormatterCallback;