Skip to content

RKMultiButton

Radio-style multi-button group for RadioKit — displays a grid or wrap of premium buttons where exactly one is selected at a time.

RKMultiButton({
required List<RKToggleItem> items,
required int selected,
required ValueChanged<int> onChanged,
double buttonSize = 64.0,
double spacing = 8.0,
double padding = 12.0,
bool enableHapticFeedback = true,
RKAxis orientation = RKAxis.horizontal,
ValueChanged<bool>? onActiveChanged,
double rotation = 0.0,
String? label,
})
ParameterDescription
itemsList of RKToggleItem (labels and icons) to display.
selectedIndex of the currently active button.
onChangedCalled with the new selected index when a button is tapped.
buttonSizeSize (width and height) of each individual button.
spacingDistance between buttons in the group.
paddingInner padding of the group container.
enableHapticFeedbackWhether to trigger haptic feedback on interaction.
orientationHorizontal or vertical layout (RKAxis).
onActiveChangedCallback when the user starts/stops touching the group.
rotationVisual rotation of the widget in radians.
labelOptional text label displayed above the widget.

A data model for buttons with state-specific labels and icons:

const RKToggleItem({
String? onLabel,
String? offLabel,
IconData? onIcon,
IconData? offIcon,
});
int _selectedIndex = 0;
RKMultiButton(
items: const [
RKToggleItem(onLabel: 'Cyber', onIcon: Icons.bolt_rounded),
RKToggleItem(onLabel: 'Tactical', onIcon: Icons.gps_fixed_rounded),
RKToggleItem(onLabel: 'Minimal', onIcon: Icons.remove_rounded),
],
selected: _selectedIndex,
orientation: RKAxis.horizontal,
onChanged: (int index) => setState(() => _selectedIndex = index),
);