theme/cupertino/radio.go
Functions
func PaintRadio
func (p RadioPainter) PaintRadio(canvas widget.Canvas, state radio.PaintState) {
if state.Bounds.IsEmpty() {
return
}
colors := state.ColorScheme
if colors == (radio.RadioColorScheme{}) {
colors = p.resolveColors()
}
disabled := state.Disabled
center, radius := cupRadioCircleGeometry(state.Bounds)
if state.Selected {
cupPaintSelectedRadio(canvas, center, radius, state, disabled, colors)
} else {
cupPaintUnselectedRadio(canvas, center, radius, state, disabled, colors)
}
// Label.
if state.Label != "" {
fg := colors.LabelColor
if disabled {
fg = colors.DisabledFg
}
labelBounds := cupRadioLabelBounds(state.Bounds)
canvas.DrawText(state.Label, labelBounds, cupRadioFontSize, fg, false, cupRadioTextAlignLeft)
}
// Focus ring.
if state.Focused && !disabled {
canvas.StrokeCircle(center, radius+cupRadioFocusRingOffset, colors.FocusRing, cupRadioFocusRingStroke)
}
}
Structs
type RadioPainter struct
RadioPainter renders radio items using Apple HIG design tokens.
Cupertino radio buttons use filled circles with accent-colored selection.
If Theme is nil, RadioPainter falls back to the default system blue palette.
type RadioPainter struct {
Theme *Theme // nil uses default system blue fallback
}
PaintRadio renders a radio item according to Apple HIG specifications.