value property
dynamic
value
final
The value currently selected in the slider.
For date value, the slider doesn’t have auto interval support. So, you may need to set interval, dateIntervalType, and dateFormat for date value, if the labels, ticks, and dividers are needed.
This snippet shows how to create a numeric SfSlider.
double _value = 4.0;
SfSlider(
min: 0.0,
max: 10.0,
value: _value,
onChanged: (dynamic newValue) {
setState(() {
_value = newValue;
});
},
)
This snippet shows how to create a date SfSlider.
DateTime _value = DateTime(2002, 01, 01);
SfSlider(
min: DateTime(2000, 01, 01, 00),
max: DateTime(2005, 12, 31, 24),
value: _value,
interval: 1,
dateFormat: DateFormat.y(),
dateIntervalType: DateIntervalType.years,
onChanged: (dynamic newValue) {
setState(() {
_value = newValue;
});
},
)
See also:
- onChanged, to update the visual appearance of the slider when the user drags the thumb through interaction.
- showTicks, to render major ticks at given interval.
- showLabels, to render labels at given interval.
Implementation
final dynamic value;