dateFormat property
DateFormat?
dateFormat
final
Formats the date labels. It is mandatory for date SfRangeSelector.
For date values, the range selector doesn’t have auto interval support. So, you may need to set interval, dateIntervalType, and dateFormat for date values, if labels, ticks, and dividers are needed.
Defaults to null
.
This snippet shows how to set date format in SfRangeSelector.
SfRangeValues _initialValues = SfRangeValues(
DateTime(2002, 01, 01), DateTime(2003, 01, 01));
SfRangeSelector(
min: DateTime(2000, 01, 01, 00),
max: DateTime(2005, 12, 31, 24),
initialValues: _initialValues,
interval: 1,
showLabels: true,
showTicks: true,
dateFormat: DateFormat.y(),
dateIntervalType: DateIntervalType.years,
child: Container(
height: 200,
color: Colors.green[100],
),
)
See also:
- interval, for setting the interval.
- numberFormat, for formatting the numeric labels.
- labelFormatterCallback, for formatting the numeric and date label.
- dateIntervalType, for changing the interval type.
Implementation
final DateFormat? dateFormat;