Skip to content

RKRockerSwitch

A premium 3D rocker switch for RadioKit featuring symmetrical ON/OFF rocker movement, mechanical snap animation, and perspective tilt.

RKRockerSwitch({
required bool value,
required ValueChanged<bool> onChanged,
double width = 72.0,
double height = 110.0,
Widget? onIcon,
Widget? offIcon,
Color? activeColor,
bool enableHapticFeedback = true,
ValueChanged<bool>? onInteractionChanged,
double rotation = 0.0,
String? label,
})
ParameterDescription
valueCurrent logical state (true = ON).
onChangedCallback invoked when the switch toggles.
width / heightSize of the switch bezel.
onIcon / offIconOptional custom widgets displayed for each state.
activeColorColour of the glow when ON; defaults to theme primary.
enableHapticFeedbackEmit a medium-impact haptic pulse on taps and drags.
onInteractionChangedOptional callback when the user begins/ends interaction.
rotationVisual rotation of the widget in radians.
labelOptional text label displayed above the widget.
bool _isOn = false;
RKRockerSwitch(
value: _isOn,
onChanged: (v) => setState(() => _isOn = v),
activeColor: Colors.redAccent,
);

The widget animates a 3D rocker with realistic shadows and a glowing rim when activated.