onboard to new custom padded box layouts
This commit is contained in:
@@ -13,6 +13,7 @@ import (
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/driver/desktop"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
@@ -195,11 +196,11 @@ func NewGridViewItem(placeholderResource fyne.Resource) *GridViewItem {
|
||||
}
|
||||
|
||||
func (g *GridViewItem) createContainer() {
|
||||
info := container.New(&layouts.VboxCustomPadding{ExtraPad: -16}, g.primaryText, g.secondaryText)
|
||||
info := container.New(layout.NewCustomPaddedVBoxLayout(theme.Padding()-16), g.primaryText, g.secondaryText)
|
||||
g.focusRect = canvas.NewRectangle(color.Transparent)
|
||||
g.focusRect.StrokeWidth = 3
|
||||
coverStack := container.NewStack(g.Cover, g.focusRect)
|
||||
c := container.New(&layouts.VboxCustomPadding{ExtraPad: -5}, coverStack, info)
|
||||
c := container.New(layout.NewCustomPaddedVBoxLayout(theme.Padding()-5), coverStack, info)
|
||||
pad := &layouts.CenterPadLayout{PadLeftRight: 20, PadTopBottom: 10}
|
||||
g.container = container.New(pad, c)
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ import (
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
||||
"github.com/dweymouth/supersonic/ui/layouts"
|
||||
myTheme "github.com/dweymouth/supersonic/ui/theme"
|
||||
)
|
||||
|
||||
@@ -50,7 +49,7 @@ func NewLargeNowPlayingCard() *LargeNowPlayingCard {
|
||||
n.cover.ScaleMode = canvas.ImageScaleFastest
|
||||
// set up the layout
|
||||
n.Content = n.cover
|
||||
n.Caption = container.New(&layouts.VboxCustomPadding{ExtraPad: -13},
|
||||
n.Caption = container.New(layout.NewCustomPaddedVBoxLayout(theme.Padding()-13),
|
||||
n.trackName,
|
||||
n.artistName,
|
||||
n.albumName,
|
||||
|
||||
@@ -135,7 +135,7 @@ func (l *ListHeader) TappedSecondary(e *fyne.PointEvent) {
|
||||
|
||||
func (l *ListHeader) setupPopUpMenu() {
|
||||
if l.popUpMenu == nil {
|
||||
l.popUpMenu = container.New(&layouts.VboxCustomPadding{ExtraPad: -10})
|
||||
l.popUpMenu = container.New(layout.NewCustomPaddedVBoxLayout(theme.Padding() - 10))
|
||||
for i, c := range l.columns {
|
||||
if c.CanToggleVisible {
|
||||
l.popUpMenu.Add(widget.NewCheck(c.Text, l.createOnChangedCallbk(i)))
|
||||
@@ -258,7 +258,7 @@ func (c *colHeader) Refresh() {
|
||||
|
||||
func (c *colHeader) CreateRenderer() fyne.WidgetRenderer {
|
||||
if c.container == nil {
|
||||
c.container = container.New(&layouts.HboxCustomPadding{DisableThemePad: true, ExtraPad: -8})
|
||||
c.container = container.New(layout.NewCustomPaddedHBoxLayout(-8))
|
||||
if c.columnCfg.Alignment != fyne.TextAlignLeading {
|
||||
c.container.Add(layout.NewSpacer())
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import (
|
||||
"image"
|
||||
|
||||
"github.com/dweymouth/supersonic/backend/mediaprovider"
|
||||
"github.com/dweymouth/supersonic/ui/layouts"
|
||||
myTheme "github.com/dweymouth/supersonic/ui/theme"
|
||||
"github.com/dweymouth/supersonic/ui/util"
|
||||
|
||||
@@ -12,6 +11,7 @@ import (
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
@@ -114,7 +114,7 @@ func (n *NowPlayingCard) CreateRenderer() fyne.WidgetRenderer {
|
||||
c := container.New(&layout.CustomPaddedLayout{LeftPadding: -4},
|
||||
container.NewBorder(nil, nil, n.cover, nil,
|
||||
container.New(&layout.CustomPaddedLayout{TopPadding: -2},
|
||||
container.New(&layouts.VboxCustomPadding{ExtraPad: -13}, n.trackName, n.artistName, n.albumName))),
|
||||
container.New(layout.NewCustomPaddedVBoxLayout(theme.Padding()-13), n.trackName, n.artistName, n.albumName))),
|
||||
)
|
||||
return widget.NewSimpleRenderer(c)
|
||||
}
|
||||
|
||||
@@ -328,7 +328,7 @@ func NewPlayQueueListRow(playQueueList *PlayQueueList, im *backend.ImageManager,
|
||||
p.Content = container.New(playQueueList.colLayout,
|
||||
container.NewCenter(p.num),
|
||||
container.NewPadded(p.cover),
|
||||
container.New(&layouts.VboxCustomPadding{ExtraPad: -15},
|
||||
container.New(layout.NewCustomPaddedVBoxLayout(theme.Padding()-15),
|
||||
p.title, p.artist),
|
||||
container.NewCenter(p.time),
|
||||
)
|
||||
|
||||
@@ -4,12 +4,12 @@ import (
|
||||
"math"
|
||||
|
||||
"github.com/dweymouth/supersonic/res"
|
||||
"github.com/dweymouth/supersonic/ui/layouts"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/canvas"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/driver/desktop"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/theme"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
@@ -43,9 +43,7 @@ func NewStarRating() *StarRating {
|
||||
}
|
||||
|
||||
func (s *StarRating) createContainer() {
|
||||
s.container = container.New(&layouts.HboxCustomPadding{
|
||||
DisableThemePad: true,
|
||||
})
|
||||
s.container = container.New(layout.NewCustomPaddedHBoxLayout(0))
|
||||
var im *canvas.Image
|
||||
for i := 0; i < 5; i++ {
|
||||
if s.IsDisabled {
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package widgets
|
||||
|
||||
import (
|
||||
"github.com/dweymouth/supersonic/ui/layouts"
|
||||
|
||||
"fyne.io/fyne/v2"
|
||||
"fyne.io/fyne/v2/container"
|
||||
"fyne.io/fyne/v2/layout"
|
||||
"fyne.io/fyne/v2/widget"
|
||||
)
|
||||
|
||||
@@ -22,7 +21,7 @@ type ToggleButtonGroup struct {
|
||||
func NewToggleButtonGroup(activatedBtnIdx int, buttons ...*widget.Button) *ToggleButtonGroup {
|
||||
t := &ToggleButtonGroup{}
|
||||
t.ExtendBaseWidget(t)
|
||||
t.buttonContainer = container.New(&layouts.HboxCustomPadding{DisableThemePad: true})
|
||||
t.buttonContainer = container.New(layout.NewCustomPaddedHBoxLayout(0))
|
||||
for i, b := range buttons {
|
||||
b.Importance = widget.MediumImportance
|
||||
t.buttonContainer.Add(b)
|
||||
|
||||
Reference in New Issue
Block a user