Skip to content

RKSlider

A premium linear slider widget for RadioKit with an industrial aesthetic, optional self-centering and fill-from-zero support.

RKSlider({
required double value,
required ValueChanged<double> onChanged,
double min = 0.0,
double max = 1.0,
RKAxis orientation = RKAxis.horizontal,
RKSliderType type = RKSliderType.linear,
double thickness = 11.0,
double length = 200.0,
ValueChanged<bool>? onInteractionChanged,
bool autoCenter = false,
double center = 0.5,
Curve springCurve = Curves.easeOutCubic,
Duration springDuration = const Duration(milliseconds: 300),
int? divisions,
bool showTicks = true,
int tickCount = 20,
double rotation = 0.0,
String? label,
})
ParameterDescription
valueCurrent slider value (normalized between min and max).
onChangedCalled with the new value when the user drags.
orientationHorizontal or vertical orientation (RKAxis).
typeVariant type (linear or gasPedal).
thicknessTrack thickness in logical pixels.
lengthTotal length of the slider (width for horizontal, height for vertical).
onInteractionChangedTriggered when the user starts or stops touching the widget.
autoCenterWhen true, the slider animates back to center after interaction ends.
centerNormalised centre position (0-1) used when autoCenter is enabled.
divisionsIf set, the slider snaps to the given number of discrete steps.
showTicks / tickCountShow minor/major tick marks along the track.
rotationVisual rotation of the widget in radians.
labelOptional text label displayed above the widget.

The RKSliderType.gasPedal variant provides a 3D perspective-transformed pedal aesthetic. Best used with autoCenter: true and center: 0.0 for a realistic spring-back feel.

double _val = 0.5;
RKSlider(
value: _val,
onChanged: (v) => setState(() => _val = v),
min: 0,
max: 100,
orientation: RKAxis.horizontal,
autoCenter: true,
center: 0.5,
);