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 slider will move the thumb 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 SfSlider.
DateTime _value = DateTime(2017, 04,01);
SfSlider(
min: DateTime(2015, 01, 01),
max: DateTime(2020, 01, 01),
value: _value,
enableTooltip: true,
stepDuration: SliderStepDuration(years: 1, months: 6),
interval: 2,
showLabels: true,
showTicks: true,
minorTicksPerInterval: 1,
dateIntervalType: DateIntervalType.years,
dateFormat: DateFormat.yMd(),
onChanged: (dynamic newValue) {
setState(() {
_value = newValue;
});
},
)
See also:
- interval, for setting the interval.
- dateIntervalType, for changing the interval type.
- dateFormat for formatting the date labels.
Implementation
final SliderStepDuration? stepDuration;