refactor(gioui): move common iconbutton code to a function

This commit is contained in:
vsariola
2021-04-20 17:57:36 +03:00
parent 8ba9fb1f00
commit c0a0a5d501
5 changed files with 31 additions and 69 deletions

20
tracker/gioui/buttons.go Normal file
View File

@ -0,0 +1,20 @@
package gioui
import (
"gioui.org/layout"
"gioui.org/unit"
"gioui.org/widget"
"gioui.org/widget/material"
)
func IconButton(th *material.Theme, w *widget.Clickable, icon []byte, enabled bool) material.IconButtonStyle {
ret := material.IconButton(th, w, widgetForIcon(icon))
ret.Background = transparent
ret.Inset = layout.UniformInset(unit.Dp(6))
if enabled {
ret.Color = primaryColor
} else {
ret.Color = disabledTextColor
}
return ret
}