feat(tracker): make clear song button to reset to default song

This commit is contained in:
vsariola 2021-01-14 19:27:25 +02:00
parent 2378be5021
commit c90f8efbdc
2 changed files with 10 additions and 1 deletions

View File

@ -22,6 +22,7 @@ var downIcon *widget.Icon
var addIcon *widget.Icon
var loadIcon *widget.Icon
var saveIcon *widget.Icon
var clearIcon *widget.Icon
func init() {
var err error
@ -45,6 +46,10 @@ func init() {
if err != nil {
log.Fatal(err)
}
clearIcon, err = widget.NewIcon(icons.ContentClear)
if err != nil {
log.Fatal(err)
}
}
func smallButton(icStyle material.IconButtonStyle) material.IconButtonStyle {

View File

@ -24,6 +24,10 @@ func (t *Tracker) layoutSongButtons(gtx C) D {
//paint.FillShape(gtx.Ops, primaryColorDark, clip.Rect(image.Rect(0, 0, gtx.Constraints.Max.X, gtx.Constraints.Max.Y)).Op())
for t.NewSongFileBtn.Clicked() {
t.LoadSong(defaultSong)
}
for t.LoadSongFileBtn.Clicked() {
t.LoadSongFile()
}
@ -32,7 +36,7 @@ func (t *Tracker) layoutSongButtons(gtx C) D {
t.SaveSongFile()
}
newBtnStyle := material.IconButton(t.Theme, t.NewSongFileBtn, addIcon)
newBtnStyle := material.IconButton(t.Theme, t.NewSongFileBtn, clearIcon)
newBtnStyle.Background = transparent
newBtnStyle.Inset = layout.UniformInset(unit.Dp(6))
newBtnStyle.Color = primaryColor