RangeSlider class

A Material Design range slider, extension of the original Flutter Slider.

Used to select a range of values using 2 thumbs.

A RangeSlider can be used to select from either a continuous or a discrete set of values. The default is to use a continuous range of values from min to max. To use discrete values, use a non-null value for divisions, which indicates the number of discrete intervals. For example, if min is 0.0 and max is 50.0 and divisions is 5, then the RangeSlider can take on the discrete values 0.0, 10.0, 20.0, 30.0, 40.0, and 50.0.

The terms for the parts of a RangeSlider are:

  • The "thumb", which is a shape that slides horizontally when the user drags it.
  • The "track", which is the line that the slider thumb slides along.
  • The "value indicator", which is a shape that pops up when the user is dragging the active thumb to indicate the value lowerValue or upperValue being selected.

The RangeSlider will be disabled if onChanged is null.

The RangeSlider widget itself does not maintain any state. Instead, when the state of the RangeSlider changes, the widget calls the onChanged callback. Most widgets that use a RangeSlider will listen for the onChanged callback and rebuild the RangeSlider with a new set of values lowerValue and upperValue to update the visual appearance of the RangeSlider.

To know when the values start to change, or when it is done changing, set the optional callbacks onChangeStart and/or onChangeEnd.

By default, a RangeSlider will be as wide as possible, centered vertically. When given unbounded constraints, it will attempt to make the track 144 pixels wide (with margins on each side) and will shrink-wrap vertically.

Requires one of its ancestors to be a Material widget.

To determine how it should be displayed (e.g. colors, thumb shape, etc.), a RangeSlider uses the SliderThemeData available from either a SliderTheme widget or the ThemeData.sliderTheme a Theme widget above it in the widget tree.

See also:



RangeSlider({Key key, double min: 0.0, double max: 1.0, int divisions, @required double lowerValue, @required double upperValue, RangeSliderCallback onChanged, RangeSliderCallback onChangeStart, RangeSliderCallback onChangeEnd, bool showValueIndicator: false, double touchRadiusExpansionRatio: 3.33, int valueIndicatorMaxDecimals: 1, RangeSliderValueIndicatorFormatter valueIndicatorFormatter, bool allowThumbOverlap: false})
Creates a material design RangeSlider. [...]


allowThumbOverlap bool
Allows thumbs to overlap (default: false)
divisions int
The number of discrete divisions. [...]
hashCode int
The hash code for this object. [...]
@nonVirtual, read-only, inherited
key Key
Controls how one widget replaces another widget in the tree. [...]
final, inherited
lowerValue double
The currently selected lower value. [...]
max double
The maximum value the user can select. [...]
min double
The minimum value the user can select. [...]
onChanged RangeSliderCallback
Callback to invoke when the user is changing the values. [...]
onChangeEnd RangeSliderCallback
Callback to invoke when the user ends the dragging [...]
onChangeStart RangeSliderCallback
Callback to invoke when the user starts dragging [...]
runtimeType Type
A representation of the runtime type of the object.
read-only, inherited
showValueIndicator bool
Do we show a label above the active thumb when the RangeSlider is active ?
touchRadiusExpansionRatio double
The ratio with which to expand the thumb size, to increase (>1) or decrease (<1) the touch surface of the thumbs. It is advised to set this value such that the touch surface of a thumb becomes at least 40.0 x 40.0. The default thumbs have a radius of 6, so a value of at least 3.33 is advisable.
upperValue double
The currently selected upper value. [...]
valueIndicatorFormatter RangeSliderValueIndicatorFormatter
External function to format the value to be displayed in the label above the active thumb. Ignored if null. [...]
valueIndicatorMaxDecimals int
Max number of decimals when displaying the value in the label above the active thumb


createElement() StatefulElement
Creates a StatefulElement to manage this widget's location in the tree. [...]
createState() → _RangeSliderState
Creates the mutable state for this widget at a given location in the tree. [...]
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children. [...]
@protected, inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node. [...]
noSuchMethod(Invocation invocation) → dynamic
Invoked when a non-existent method or property is accessed. [...]
toDiagnosticsNode({String name, DiagnosticsTreeStyle style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep. [...]
toString({DiagnosticLevel minLevel: DiagnosticLevel.info}) String
Returns a string representation of this object.
toStringDeep({String prefixLineOne: '', String prefixOtherLines, DiagnosticLevel minLevel: DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants. [...]
toStringShallow({String joiner: ', ', DiagnosticLevel minLevel: DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object. [...]
toStringShort() String
A short, textual description of this widget.


operator ==(Object other) bool
The equality operator. [...]
@nonVirtual, inherited