update fixedSize

This commit is contained in:
aynakeya
2025-10-07 00:30:54 +08:00
parent 5c508b9664
commit 2838a02c83
2 changed files with 32 additions and 4 deletions

View 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(),
}
}

View File

@@ -33,7 +33,7 @@ type PlayControllerContainer struct {
ButtonLrc *widget.Button
ButtonPlayer *widget.Button
LrcWindowOpen bool
CurrentTime *widget.Label
CurrentTime *component.LabelFixedSize
TotalTime *widget.Label
}
@@ -65,6 +65,12 @@ func registerPlayControllerHandler() {
}
}
gctx.Context.OnMainWindowClosing(func() {
if lyricWindow != nil {
lyricWindow.Close()
}
})
PlayController.ButtonPlayer.OnTapped = func() {
showPlayerWindow()
}
@@ -220,12 +226,12 @@ func createPlayControllerV2() fyne.CanvasObject {
controls.SeparatorThickness = 0
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")
progressItem := container.NewBorder(nil, nil,
nil,
PlayController.CurrentTime,
PlayController.TotalTime,
component.NewFixedHSplitContainer(PlayController.CurrentTime, PlayController.Progress, 0.1))
PlayController.Progress)
PlayController.Title = widget.NewLabel("Title")
PlayController.Title.Truncation = fyne.TextTruncateClip