theme/fluent/checkbox.go
Functions
func PaintCheckbox
func (p CheckboxPainter) PaintCheckbox(canvas widget.Canvas, state checkbox.PaintState) {
if state.Bounds.IsEmpty() {
return
}
colors := state.ColorScheme
if colors == (checkbox.CheckboxColorScheme{}) {
colors = p.resolveColors()
}
boxRect := flCheckboxBoxRect(state.Bounds)
disabled := state.Disabled
if state.Checked || state.Indeterminate {
flPaintCheckedBox(canvas, boxRect, state, disabled, colors)
} else {
flPaintUncheckedBox(canvas, boxRect, state, disabled, colors)
}
// Label.
if state.Label != "" {
fg := colors.LabelColor
if disabled {
fg = colors.DisabledFg
}
labelBounds := flCheckboxLabelBounds(state.Bounds)
canvas.DrawText(state.Label, labelBounds, flCBFontSize, fg, false, flCBTextAlignLeft)
}
// Focus indicator.
if state.Focused && !disabled {
flDrawFocusRing(canvas, boxRect, flCBCornerRadius, colors.FocusRing)
}
}
Structs
type CheckboxPainter struct
CheckboxPainter renders checkboxes using Fluent Design tokens.
If Theme is nil, CheckboxPainter falls back to the default Fluent Blue palette.
type CheckboxPainter struct {
Theme *Theme // nil uses default Fluent Blue fallback
}
PaintCheckbox renders a checkbox according to Fluent Design specifications.