remove separators and make page background darker

This commit is contained in:
Drew Weymouth
2023-01-03 16:26:03 -08:00
parent 44536b8bef
commit e5c9920c12
4 changed files with 47 additions and 13 deletions
+1 -2
View File
@@ -8,7 +8,6 @@ import (
"time"
"fyne.io/fyne/v2/app"
"fyne.io/fyne/v2/theme"
"github.com/20after4/configdir"
"github.com/zalando/go-keyring"
)
@@ -29,7 +28,7 @@ func main() {
}
fyneApp := app.New()
fyneApp.Settings().SetTheme(theme.DarkTheme())
fyneApp.Settings().SetTheme(&ui.MyTheme{})
mainWindow := ui.NewMainWindow(fyneApp, appname, myApp)
// TODO: There is some race condition with running this initial startup
+1 -2
View File
@@ -100,9 +100,8 @@ func NewBottomPanel(p *player.Player) *BottomPanel {
_ = p.SetVolume(v)
}
main := container.New(newBottomPanelLayout(500, bp.NowPlaying, bp.Controls, bp.AuxControls),
bp.container = container.New(newBottomPanelLayout(500, bp.NowPlaying, bp.Controls, bp.AuxControls),
bp.NowPlaying, bp.Controls, bp.AuxControls)
bp.container = container.NewBorder(widgets.NewThickSeparator(), nil, nil, nil, main)
return bp
}
+13 -9
View File
@@ -1,19 +1,22 @@
package ui
import (
"image/color"
"supersonic/backend"
"supersonic/ui/widgets"
"sync"
"time"
"fyne.io/fyne/v2"
"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"
)
type Page interface {
fyne.Widget
fyne.CanvasObject
}
type Searchable interface {
@@ -41,11 +44,12 @@ type BrowsingPane struct {
pendingSearch bool
searchGoroutine bool
container *fyne.Container
pageContainer *fyne.Container
container *fyne.Container
}
type blankPage struct {
widget.Separator
layout.Spacer
}
func NewBrowsingPane(app *backend.App) *BrowsingPane {
@@ -56,12 +60,12 @@ func NewBrowsingPane(app *backend.App) *BrowsingPane {
b.back = widget.NewButtonWithIcon("", theme.NavigateBackIcon(), b.GoBack)
b.forward = widget.NewButtonWithIcon("", theme.NavigateNextIcon(), b.GoForward)
b.curPage = &blankPage{}
b.pageContainer = container.NewMax(
canvas.NewRectangle(color.RGBA{R: 24, G: 24, B: 24, A: 255}),
b.curPage)
b.container = container.NewBorder(
container.NewVBox(
container.NewHBox(b.back, b.forward, b.searchBar),
widgets.NewThickSeparator(),
),
nil, nil, nil, b.curPage)
container.NewHBox(b.back, b.forward, b.searchBar),
nil, nil, nil, b.pageContainer)
return b
}
@@ -79,7 +83,7 @@ func (b *BrowsingPane) doSetPage(p Page) {
}
_, s := p.(Searchable)
b.searchBar.Hidden = !s
b.container.Objects[0] = p
b.pageContainer.Objects[1] = p
b.Refresh()
}
+32
View File
@@ -0,0 +1,32 @@
package ui
import (
"image/color"
"fyne.io/fyne/v2"
"fyne.io/fyne/v2/theme"
)
type MyTheme struct{}
var _ fyne.Theme = (*MyTheme)(nil)
func (m MyTheme) Color(name fyne.ThemeColorName, variant fyne.ThemeVariant) color.Color {
if name == theme.ColorNameScrollBar {
return theme.DarkTheme().Color(theme.ColorNameForeground, variant)
}
return theme.DarkTheme().Color(name, variant)
}
func (m MyTheme) Icon(name fyne.ThemeIconName) fyne.Resource {
return theme.DefaultTheme().Icon(name)
}
func (m MyTheme) Font(style fyne.TextStyle) fyne.Resource {
return theme.DefaultTheme().Font(style)
}
func (m MyTheme) Size(name fyne.ThemeSizeName) float32 {
return theme.DefaultTheme().Size(name)
}