theme/cupertino/dialog.go
Functions
func PaintDialog
func (p DialogPainter) PaintDialog(canvas widget.Canvas, ps dialog.PaintState) {
if ps.Bounds.IsEmpty() {
return
}
colors := ps.ColorScheme
if colors == (dialog.DialogColorScheme{}) {
colors = p.resolveColors()
}
// iOS alert: heavy rounded corners, no border.
canvas.DrawRoundRect(ps.Bounds, colors.Surface, cupDlgRadius)
// Title (centered, bold).
if ps.Title != "" {
titleBounds := geometry.Rect{
Min: geometry.Pt(ps.Bounds.Min.X+cupDlgPadding, ps.Bounds.Min.Y+cupDlgPadding),
Max: geometry.Pt(ps.Bounds.Max.X-cupDlgPadding, ps.Bounds.Min.Y+cupDlgPadding+cupDlgTitleHeight),
}
canvas.DrawText(ps.Title, titleBounds, cupDlgTitleFontSize, colors.Title, true, cupDlgTextAlignCenter)
}
// Action buttons (right-aligned, accent color text).
p.paintActions(canvas, ps, colors)
// Focus indicator.
if ps.Focused {
ringBounds := ps.Bounds.Expand(cupDlgFocusRingOffset)
ringRadius := cupDlgRadius + cupDlgFocusRingOffset
canvas.StrokeRoundRect(ringBounds, colors.ActionFg.WithAlpha(cupDlgFocusRingAlpha), ringRadius, cupDlgFocusRingStroke)
}
}
Structs
type DialogPainter struct
DialogPainter renders dialogs using Apple HIG design tokens.
Cupertino dialogs follow the iOS alert/sheet style: rounded corners,
grouped background, centered title, and stacked or horizontal action buttons.
If Theme is nil, DialogPainter falls back to the default system blue palette.
type DialogPainter struct {
Theme *Theme // nil uses default system blue fallback
}
PaintDialog renders a dialog according to Apple HIG specifications.