mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-06 18:32:50 +08:00
update fixedSize
This commit is contained in:
22
gui/component/fixedsize.go
Normal file
22
gui/component/fixedsize.go
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package component
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/widget"
|
||||||
|
)
|
||||||
|
|
||||||
|
type LabelFixedSize struct {
|
||||||
|
*widget.Label
|
||||||
|
fixedSize fyne.Size
|
||||||
|
}
|
||||||
|
|
||||||
|
func (t *LabelFixedSize) MinSize() fyne.Size {
|
||||||
|
return t.fixedSize
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewLabelFixedSize(label *widget.Label) *LabelFixedSize {
|
||||||
|
return &LabelFixedSize{
|
||||||
|
Label: label,
|
||||||
|
fixedSize: label.MinSize(),
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -33,7 +33,7 @@ type PlayControllerContainer struct {
|
|||||||
ButtonLrc *widget.Button
|
ButtonLrc *widget.Button
|
||||||
ButtonPlayer *widget.Button
|
ButtonPlayer *widget.Button
|
||||||
LrcWindowOpen bool
|
LrcWindowOpen bool
|
||||||
CurrentTime *widget.Label
|
CurrentTime *component.LabelFixedSize
|
||||||
TotalTime *widget.Label
|
TotalTime *widget.Label
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,6 +65,12 @@ func registerPlayControllerHandler() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gctx.Context.OnMainWindowClosing(func() {
|
||||||
|
if lyricWindow != nil {
|
||||||
|
lyricWindow.Close()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
PlayController.ButtonPlayer.OnTapped = func() {
|
PlayController.ButtonPlayer.OnTapped = func() {
|
||||||
showPlayerWindow()
|
showPlayerWindow()
|
||||||
}
|
}
|
||||||
@@ -220,12 +226,12 @@ func createPlayControllerV2() fyne.CanvasObject {
|
|||||||
controls.SeparatorThickness = 0
|
controls.SeparatorThickness = 0
|
||||||
|
|
||||||
PlayController.Progress = component.NewSliderPlus(0, 1000)
|
PlayController.Progress = component.NewSliderPlus(0, 1000)
|
||||||
PlayController.CurrentTime = widget.NewLabel("00:00")
|
PlayController.CurrentTime = component.NewLabelFixedSize(widget.NewLabel("00:00"))
|
||||||
PlayController.TotalTime = widget.NewLabel("00:00")
|
PlayController.TotalTime = widget.NewLabel("00:00")
|
||||||
progressItem := container.NewBorder(nil, nil,
|
progressItem := container.NewBorder(nil, nil,
|
||||||
nil,
|
PlayController.CurrentTime,
|
||||||
PlayController.TotalTime,
|
PlayController.TotalTime,
|
||||||
component.NewFixedHSplitContainer(PlayController.CurrentTime, PlayController.Progress, 0.1))
|
PlayController.Progress)
|
||||||
|
|
||||||
PlayController.Title = widget.NewLabel("Title")
|
PlayController.Title = widget.NewLabel("Title")
|
||||||
PlayController.Title.Truncation = fyne.TextTruncateClip
|
PlayController.Title.Truncation = fyne.TextTruncateClip
|
||||||
|
|||||||
Reference in New Issue
Block a user