diff --git a/main.go b/main.go index 7463d1f..1d69e1e 100644 --- a/main.go +++ b/main.go @@ -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 diff --git a/ui/bottompanel.go b/ui/bottompanel.go index 17b8ac7..a942b42 100644 --- a/ui/bottompanel.go +++ b/ui/bottompanel.go @@ -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 } diff --git a/ui/browsingpane.go b/ui/browsingpane.go index bcc1fd6..c964880 100644 --- a/ui/browsingpane.go +++ b/ui/browsingpane.go @@ -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() } diff --git a/ui/theme.go b/ui/theme.go new file mode 100644 index 0000000..0b88070 --- /dev/null +++ b/ui/theme.go @@ -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) +}