stepDuration property
Option to select discrete date values.
For example, if min is DateTime(2015, 01, 01) and max is DateTime(2020, 01, 01) and stepDuration is SliderStepDuration(years: 1, months: 6), the range slider will move the thumbs at DateTime(2015, 01, 01), DateTime(2016, 07, 01), DateTime(2018, 01, 01),and DateTime(2019, 07, 01).
Defaults to null
.
This snippet shows how to set stepDuration in SfRangeSlider.
SfRangeValues _values = SfRangeValues(
DateTime(2017, 04,01), DateTime(2018, 08, 01));
SfRangeSlider(
min: DateTime(2015, 01, 01),
max: DateTime(2020, 01, 01),
values: _values,
enableTooltip: true,
stepDuration: SliderStepDuration(years: 1, months: 6),
interval: 2,
showLabels: true,
showTicks: true,
minorTicksPerInterval: 1,
dateIntervalType: DateIntervalType.years,
dateFormat: DateFormat.yMd(),
onChanged: (SfRangeValues newValues) {
setState(() {
_values = newValues;
});
},
)
See also:
- interval, for setting the interval.
- dateIntervalType, for changing the interval type.
- dateFormat for formatting the date labels.
Implementation
final SliderStepDuration? stepDuration;