theme/material3/listview.go
Functions
func PaintDivider
func (p ListViewPainter) PaintDivider(canvas widget.Canvas, ds listview.DividerState) {
if ds.Bounds.IsEmpty() {
return
}
colors := ds.ColorScheme
if colors == (listview.ListColorScheme{}) {
colors = p.resolveColors()
}
ds.ColorScheme = colors
listview.DefaultPainter{}.PaintDivider(canvas, ds)
}
func PaintEmptyState
PaintEmptyState draws a M3-styled empty state message.
func (p ListViewPainter) PaintEmptyState(canvas widget.Canvas, bounds geometry.Rect) {
if bounds.IsEmpty() {
return
}
colors := p.resolveColors()
canvas.DrawText(
m3EmptyStateText,
bounds,
m3EmptyStateFontSize,
colors.EmptyTextColor,
false,
m3EmptyStateAlign,
)
}
func PaintItemBackground
PaintItemBackground draws the M3 item background with hover state.
func (p ListViewPainter) PaintItemBackground(canvas widget.Canvas, ips listview.ItemPaintState) {
if ips.Bounds.IsEmpty() {
return
}
colors := ips.ColorScheme
if colors == (listview.ListColorScheme{}) {
colors = p.resolveColors()
}
ips.ColorScheme = colors
listview.DefaultPainter{}.PaintItemBackground(canvas, ips)
}
func PaintSelection
PaintSelection draws the M3 selection highlight.
func (p ListViewPainter) PaintSelection(canvas widget.Canvas, ips listview.ItemPaintState) {
if ips.Bounds.IsEmpty() || !ips.Selected {
return
}
colors := ips.ColorScheme
if colors == (listview.ListColorScheme{}) {
colors = p.resolveColors()
}
ips.ColorScheme = colors
listview.DefaultPainter{}.PaintSelection(canvas, ips)
}
Structs
type ListViewPainter struct
ListViewPainter renders list view elements using Material 3 design tokens.
It maps list states (divider, empty, hover, selection) to the M3 color scheme
and applies appropriate visual feedback.
If Theme is nil, ListViewPainter falls back to the default M3 purple palette.
type ListViewPainter struct {
Theme *Theme // nil uses default M3 purple fallback
}
PaintDivider draws a M3-styled divider between list items.