theme/fluent/dialog.go

Functions Structs

Functions

func PaintDialog

PaintDialog renders a dialog according to Fluent Design specifications.

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()
	}

	// Surface with border.
	canvas.DrawRoundRect(ps.Bounds, colors.Surface, flDialogRadius)
	canvas.StrokeRoundRect(ps.Bounds, colors.Border, flDialogRadius, flDialogBorderWidth)

	// Title.
	if ps.Title != "" {
		titleBounds := geometry.Rect{
			Min:	geometry.Pt(ps.Bounds.Min.X+flDialogPadding, ps.Bounds.Min.Y+flDialogPadding),
			Max:	geometry.Pt(ps.Bounds.Max.X-flDialogPadding, ps.Bounds.Min.Y+flDialogPadding+flDialogTitleHeight),
		}
		canvas.DrawText(ps.Title, titleBounds, flDialogTitleFontSize, colors.Title, true, flDialogTextAlignLeft)
	}

	// Action buttons.
	p.paintActions(canvas, ps, colors)

	// Focus indicator.
	if ps.Focused {
		flDrawFocusRing(canvas, ps.Bounds, flDialogRadius, colors.ActionFg)
	}
}

Structs

type DialogPainter struct

DialogPainter renders dialogs using Fluent Design tokens.

Fluent dialogs have a clean surface with subtle border and smaller

corner radius compared to Material 3.

 

If Theme is nil, DialogPainter falls back to the default Fluent Blue palette.

type DialogPainter struct {
	Theme *Theme	// nil uses default Fluent Blue fallback
}