widget/material: add focus and hover indicators to Clickable

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2022-02-28 16:49:43 +01:00
parent f711e7eaa8
commit 50e35c9c3f
2 changed files with 7 additions and 0 deletions
+3
View File
@@ -94,6 +94,9 @@ func Clickable(gtx layout.Context, button *widget.Clickable, w layout.Widget) la
return layout.Stack{}.Layout(gtx,
layout.Expanded(func(gtx layout.Context) layout.Dimensions {
defer clip.Rect{Max: gtx.Constraints.Min}.Push(gtx.Ops).Pop()
if button.Hovered() || button.Focused() {
paint.Fill(gtx.Ops, f32color.Hovered(color.NRGBA{}))
}
for _, c := range button.History() {
drawInk(gtx, c)
}