more work on album filters

This commit is contained in:
Drew Weymouth
2023-05-11 16:45:47 -07:00
parent b2dce99714
commit 87ae111cb2
10 changed files with 250 additions and 206 deletions
+41
View File
@@ -0,0 +1,41 @@
package widgets
import (
"github.com/dweymouth/supersonic/res"
"github.com/dweymouth/supersonic/ui/theme"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
)
type FavoriteButton struct {
widget.Button
IsFavorited bool
}
func NewFavoriteButton(onTapped func()) *FavoriteButton {
f := &FavoriteButton{
Button: widget.Button{
OnTapped: onTapped,
Icon: res.ResHeartOutlineInvertPng,
},
}
f.ExtendBaseWidget(f)
return f
}
func (f *FavoriteButton) Tapped(e *fyne.PointEvent) {
f.IsFavorited = !f.IsFavorited
f.Button.Tapped(e)
f.Refresh()
}
func (f *FavoriteButton) Refresh() {
if f.IsFavorited {
f.Icon = theme.FavoriteIcon
} else {
f.Icon = theme.NotFavoriteIcon
}
f.Button.Refresh()
}