RangeSlider constructor Null safety
- {Key? key,
- required RangeValues values,
- required ValueChanged<
RangeValues> ? onChanged, - ValueChanged<
RangeValues> ? onChangeStart, - ValueChanged<
RangeValues> ? onChangeEnd, - double min = 0.0,
- double max = 1.0,
- int? divisions,
- RangeLabels? labels,
- Color? activeColor,
- Color? inactiveColor,
- SemanticFormatterCallback? semanticFormatterCallback}
Creates a Material Design range slider.
The range slider widget itself does not maintain any state. Instead, when
the state of the slider changes, the widget calls the onChanged callback.
Most widgets that use a range slider will listen for the onChanged callback
and rebuild the slider with a new value
to update the visual appearance of
the slider. To know when the value starts to change, or when it is done
changing, set the optional callbacks onChangeStart and/or onChangeEnd.
- values, which determines currently selected values for this range slider.
- onChanged, which is called while the user is selecting a new value for the range slider.
- onChangeStart, which is called when the user starts to select a new value for the range slider.
- onChangeEnd, which is called when the user is done selecting a new value for the range slider.
You can override some of the colors with the activeColor and inactiveColor properties, although more fine-grained control of the appearance is achieved using a SliderThemeData.
The values, min, max must not be null. The min must be less than or equal to the max. values.start must be less than or equal to values.end. values.start and values.end must be greater than or equal to the min and less than or equal to the max. The divisions must be null or greater than 0.
Implementation
RangeSlider({
super.key,
required this.values,
required this.onChanged,
this.onChangeStart,
this.onChangeEnd,
this.min = 0.0,
this.max = 1.0,
this.divisions,
this.labels,
this.activeColor,
this.inactiveColor,
this.semanticFormatterCallback,
}) : assert(values != null),
assert(min != null),
assert(max != null),
assert(min <= max),
assert(values.start <= values.end),
assert(values.start >= min && values.start <= max),
assert(values.end >= min && values.end <= max),
assert(divisions == null || divisions > 0);