Move loop button to auxiliary controls, change button color on toggle
This commit is contained in:
@@ -14,6 +14,7 @@ type AuxControls struct {
|
||||
widget.BaseWidget
|
||||
|
||||
VolumeControl *VolumeControl
|
||||
loop *widget.Button
|
||||
|
||||
container *fyne.Container
|
||||
}
|
||||
@@ -21,8 +22,17 @@ type AuxControls struct {
|
||||
func NewAuxControls(initialVolume int) *AuxControls {
|
||||
a := &AuxControls{
|
||||
VolumeControl: NewVolumeControl(initialVolume),
|
||||
loop: widget.NewButtonWithIcon("", theme.MediaReplayIcon(), func() {}),
|
||||
}
|
||||
a.container = container.NewHBox(layout.NewSpacer(), a.VolumeControl)
|
||||
a.container = container.NewHBox(
|
||||
layout.NewSpacer(),
|
||||
container.NewVBox(
|
||||
layout.NewSpacer(),
|
||||
a.VolumeControl,
|
||||
container.NewCenter(layout.NewSpacer(), a.loop),
|
||||
layout.NewSpacer(),
|
||||
),
|
||||
)
|
||||
return a
|
||||
}
|
||||
|
||||
@@ -31,6 +41,19 @@ func (a *AuxControls) CreateRenderer() fyne.WidgetRenderer {
|
||||
return widget.NewSimpleRenderer(a.container)
|
||||
}
|
||||
|
||||
func (a *AuxControls) OnChangeLoopMode(f func()) {
|
||||
a.loop.OnTapped = f
|
||||
}
|
||||
|
||||
func (a *AuxControls) SetLoopMode(mode string) {
|
||||
if mode == "all" {
|
||||
a.loop.Importance = widget.HighImportance
|
||||
} else {
|
||||
a.loop.Importance = widget.MediumImportance
|
||||
}
|
||||
a.loop.Refresh()
|
||||
}
|
||||
|
||||
type volumeSlider struct {
|
||||
widget.Slider
|
||||
|
||||
|
||||
Reference in New Issue
Block a user