interval property

double? interval
final

Splits the range slider into given interval. It is mandatory if labels, major ticks and dividers are needed.

For example, if min is 0.0 and max is 10.0 and interval is 2.0, the range slider will render the labels, major ticks, and dividers at 0.0, 2.0, 4.0 and so on.

For date values, the range slider 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.

For example, if min is DateTime(2000, 01, 01, 00) and max is DateTime(2005, 12, 31, 24), interval is 1.0, dateFormat is DateFormat.y(), and dateIntervalType is DateIntervalType.years, then the range slider will render the labels, major ticks, and dividers at 2000, 2001, 2002 and so on.

Defaults to null. Must be greater than 0.

This snippet shows how to set numeric interval in SfRangeSlider.

SfRangeValues _values = SfRangeValues(4.0, 8.0);

SfRangeSlider(
  min: 0.0,
  max: 10.0,
  values: _values,
  interval: 2,
  showTicks: true,
  showLabels: true,
  onChanged: (SfRangeValues newValues) {
    setState(() {
      _values = newValues;
    });
   },
)

This snippet shows how to set date interval in SfRangeSlider.

SfRangeValues _values = SfRangeValues(
        DateTime(2002, 01, 01), DateTime(2003, 01, 01));

SfRangeSlider(
  min: DateTime(2000, 01, 01, 00),
  max: DateTime(2005, 12, 31, 24),
  values: _values,
  interval: 1,
  showTicks: true,
  showLabels: true,
  dateFormat: DateFormat.y(),
  dateIntervalType: DateIntervalType.years,
  onChanged: (SfRangeValues newValues) {
    setState(() {
     _values = newValues;
    });
  },
)

See also:

Implementation

final double? interval;