Skip to main content

Slider

A draggable horizontal slider for selecting a value within a range.

When to use it

Use a Slider to let the user pick a numeric value by dragging — for example, volume, brightness, or a price filter. The visual scale runs from start to end. The selectable range can be narrowed to minmax: portions of the track outside that range are rendered in a dimmed style with a tick mark at each boundary, and the thumb cannot be dragged beyond those bounds. Pass null for onChanged to render the slider as disabled.

Import

import 'package:catalyst_ui/catalyst_ui.dart';

Usage

Slider(
value: _volume,
onChanged: (v) => setState(() => _volume = v),
)

Parameters

ParameterTypeDefaultDescription
valuedoublerequiredThe current value, which must be within [min, max].
onChangedValueChanged<double>?requiredCalled continuously as the user drags. null disables.
startdouble0Where the slider scale begins.
enddouble1Where the slider scale ends.
mindouble?startThe minimum selectable value. When greater than start, a dimmed track overlay and a tick mark are shown between start and this value.
maxdouble?endThe maximum selectable value. When less than end, a dimmed track overlay and a tick mark are shown between this value and end.
onChangeStartedVoidCallback?nullCalled when the user begins dragging.
onChangeEndedVoidCallback?nullCalled when the user stops dragging.