refactor(gioui): move common button code to two functions

This commit is contained in:
vsariola
2021-04-20 18:21:21 +03:00
parent c0a0a5d501
commit e544e955cb
5 changed files with 28 additions and 34 deletions

View File

@ -112,13 +112,11 @@ func (t *Tracker) layoutSongOptions(gtx C) D {
in := layout.UniformInset(unit.Dp(1))
panicBtnStyle := material.Button(t.Theme, t.PanicBtn, "Panic")
var panicBtnStyle material.ButtonStyle
if t.player.Enabled() {
panicBtnStyle.Background = transparent
panicBtnStyle.Color = t.Theme.Palette.Fg
panicBtnStyle = LowEmphasisButton(t.Theme, t.PanicBtn, "Panic")
} else {
panicBtnStyle.Background = t.Theme.Palette.Fg
panicBtnStyle.Color = t.Theme.Palette.ContrastFg
panicBtnStyle = HighEmphasisButton(t.Theme, t.PanicBtn, "Panic")
}
for t.PanicBtn.Clicked() {