tooltipTextFormatterCallback property
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 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 tooltip format in SfRangeSelector.
SfRangeValues _initialValues = SfRangeValues(
DateTime(2010, 01, 01, 13, 00, 00),
DateTime(2010, 01, 01, 17, 00, 00));
SfRangeSelector(
min: DateTime(2010, 01, 01, 9, 00, 00),
max: DateTime(2010, 01, 01, 21, 05, 00),
initialValues: _initialValues,
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);
},
child: Container(
height: 200,
color: Colors.green[100],
),
)
Implementation
final TooltipTextFormatterCallback? tooltipTextFormatterCallback;