add netease login plugin

This commit is contained in:
Aynakeya
2022-07-13 18:59:04 -07:00
parent 6f5cfc9028
commit 41e2a4775a
15 changed files with 399 additions and 135 deletions

View File

@@ -0,0 +1,52 @@
package gui
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/widget"
)
// AsyncButton is a Button that handle OnTapped handler asynchronously.
type AsyncButton struct {
widget.Button
anim *fyne.Animation
}
func NewAsyncButton(label string, tapped func()) *AsyncButton {
button := &AsyncButton{
Button: widget.Button{
Text: label,
OnTapped: tapped,
},
}
button.ExtendBaseWidget(button)
return button
}
func NewAsyncButtonWithIcon(label string, icon fyne.Resource, tapped func()) *AsyncButton {
button := &AsyncButton{
Button: widget.Button{
Text: label,
Icon: icon,
OnTapped: tapped,
},
}
button.ExtendBaseWidget(button)
return button
}
func (b *AsyncButton) Tapped(e *fyne.PointEvent) {
if b.Disabled() {
return
}
// missing animation
b.Refresh()
if b.OnTapped != nil {
b.Disable()
go func() {
b.OnTapped()
b.Enable()
}()
}
}

View File

@@ -2,6 +2,7 @@ package gui
import (
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/container"
"fyne.io/fyne/v2/widget"
)
@@ -11,5 +12,10 @@ type RoomLoggerContainer struct {
var RoomLogger = &RoomLoggerContainer{}
func createRoomLogger() fyne.CanvasObject {
return widget.NewLabel("广告位招租")
//b := NewAsyncButton("ceshi", func() {
// time.Sleep(time.Second * 5)
//})
return container.NewVBox(
widget.NewLabel("广告位招租"),
)
}