Skip to content

RKJoystick

A premium 2-axis joystick widget for RadioKit offering smooth circular motion, optional auto-centering and a labelled display.

RKJoystick({
required ValueChanged<RKJoystickValue> onChanged,
RKJoystickValue? value,
RKJoystickValue center = const RKJoystickValue(x: 0, y: 0),
double size = 140.0,
bool autoCenter = true,
String? label,
Curve springCurve = Curves.easeOutCubic,
Duration springDuration = const Duration(milliseconds: 300),
double rotation = 0.0,
})
ParameterDescription
onChangedCallback receiving an RKJoystickValue with x, y (-1..1) and isActive.
valueOptional external value to drive the joystick position.
centerThe neutral centre position (default centre).
sizeOverall diameter of the joystick area.
autoCenterWhen true, the knob returns to center after drag ends.
labelOptional text label displayed above the widget.
springCurve / springDurationControls the spring-back animation when auto-centering.
rotationVisual rotation of the widget in radians.
RKJoystickValue _pos = const RKJoystickValue();
RKJoystick(
value: _pos,
onChanged: (v) => setState(() => _pos = v),
label: 'Direction',
);

The widget renders a 3D styled base with a movable thumb that follows the user’s drag within the circular bounds.