mirror of
https://github.com/vsariola/sointu.git
synced 2025-07-18 21:14:31 -04:00
refactor(gioui): move common iconbutton code to a function
This commit is contained in:
20
tracker/gioui/buttons.go
Normal file
20
tracker/gioui/buttons.go
Normal 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
|
||||
}
|
Reference in New Issue
Block a user