mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-13 21:48:30 +08:00
重写controller部分,修改search界面,添加歌词滚动效果,部分资源添加到bundle,修复拖动进度条时产生的噪音
This commit is contained in:
43
gui/component/button.go
Normal file
43
gui/component/button.go
Normal file
@@ -0,0 +1,43 @@
|
||||
package component
|
||||
|
||||
import (
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
type AsyncButton struct {
|
||||
widget.Button
|
||||
}
|
||||
|
||||
func NewAsyncButton(label string, tapped func()) *AsyncButton {
|
||||
b := &AsyncButton{
|
||||
Button: widget.Button{
|
||||
Text: label,
|
||||
},
|
||||
}
|
||||
b.ExtendBaseWidget(b)
|
||||
b.SetOnTapped(tapped)
|
||||
return b
|
||||
}
|
||||
|
||||
func NewAsyncButtonWithIcon(label string, icon fyne.Resource, tapped func()) *AsyncButton {
|
||||
b := &AsyncButton{
|
||||
Button: widget.Button{
|
||||
Text: label,
|
||||
Icon: icon,
|
||||
},
|
||||
}
|
||||
b.ExtendBaseWidget(b)
|
||||
b.SetOnTapped(tapped)
|
||||
return b
|
||||
}
|
||||
|
||||
func (b *AsyncButton) SetOnTapped(f func()) {
|
||||
b.Button.OnTapped = func() {
|
||||
b.Disable()
|
||||
go func() {
|
||||
f()
|
||||
b.Enable()
|
||||
}()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user