persist favorites page view settings

This commit is contained in:
Drew Weymouth
2023-02-22 19:38:24 -08:00
parent d86f92c524
commit 06bfcfe822
4 changed files with 45 additions and 12 deletions
+9 -4
View File
@@ -43,19 +43,24 @@ func (t *ToggleButtonGroup) ActivatedButtonIndex() int {
return t.activeBtnIdx
}
func (t *ToggleButtonGroup) onTapped(btnIdx int) bool {
func (t *ToggleButtonGroup) SetActivatedButton(idx int) {
changed := t.activeBtnIdx != idx
t.activeBtnIdx = idx
for i, b := range t.buttonContainer.Objects {
if i == btnIdx {
if i == idx {
b.(*widget.Button).Importance = widget.HighImportance
} else {
b.(*widget.Button).Importance = widget.MediumImportance
}
}
changed := t.activeBtnIdx != btnIdx
t.activeBtnIdx = btnIdx
if changed {
t.Refresh()
}
}
func (t *ToggleButtonGroup) onTapped(btnIdx int) bool {
changed := t.activeBtnIdx != btnIdx
t.SetActivatedButton(btnIdx)
return changed
}