RangeSlider constructor
- 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,
- MaterialStateProperty<
Color?> ? overlayColor, - MaterialStateProperty<
MouseCursor?> ? mouseCursor, - 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 new values
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 min
must be less than or equal to the max
.
The RangeValues.start attribute of the values
parameter must be less
than or equal to its RangeValues.end attribute. The RangeValues.start
and RangeValues.end attributes of the values
parameter must be greater
than or equal to the min
parameter and less than or equal to the max
parameter.
The divisions
parameter must be null or greater than zero.
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.overlayColor,
this.mouseCursor,
this.semanticFormatterCallback,
}) : 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);