app: move 'search tab' creation to search.go
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
bd58ca6608
commit
37bdd08e41
@ -79,7 +79,7 @@ func makeTabs() *container.AppTabs {
|
|||||||
tabs := container.NewAppTabs(
|
tabs := container.NewAppTabs(
|
||||||
container.NewTabItem("xkcd comic", makeBrowseUI()),
|
container.NewTabItem("xkcd comic", makeBrowseUI()),
|
||||||
container.NewTabItem("what if?", widget.NewLabel("serious answers to absurd questions and absurd advice for common concerns from xkcd's Randall Munroe")),
|
container.NewTabItem("what if?", widget.NewLabel("serious answers to absurd questions and absurd advice for common concerns from xkcd's Randall Munroe")),
|
||||||
container.NewTabItemWithIcon("search", theme.SearchIcon(), widget.NewEntry()),
|
container.NewTabItemWithIcon("search", theme.SearchIcon(), makeSearchTab()),
|
||||||
)
|
)
|
||||||
return tabs
|
return tabs
|
||||||
}
|
}
|
||||||
|
39
xkcdreader/search.go
Normal file
39
xkcdreader/search.go
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
// Copyright 2022 wanderer <a_mirre at utb dot cz>
|
||||||
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
package xkcdreader
|
||||||
|
|
||||||
|
import (
|
||||||
|
"log"
|
||||||
|
|
||||||
|
"fyne.io/fyne/v2"
|
||||||
|
"fyne.io/fyne/v2/container"
|
||||||
|
"fyne.io/fyne/v2/widget"
|
||||||
|
)
|
||||||
|
|
||||||
|
func makeSearchTab() *fyne.Container {
|
||||||
|
c := container.NewMax(
|
||||||
|
container.NewVBox(
|
||||||
|
widget.NewLabel("You want me to look in..."),
|
||||||
|
container.NewHBox(
|
||||||
|
widget.NewCheck("xkcd", func(value bool) {
|
||||||
|
// TODO(me): have this preference saved in a config or sth
|
||||||
|
log.Println("'search in xkcd' set to", value)
|
||||||
|
}),
|
||||||
|
widget.NewCheck("what if?", func(value bool) {
|
||||||
|
log.Println("'search in what if?' set to", value)
|
||||||
|
})),
|
||||||
|
makeSearchEntry(),
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
return c
|
||||||
|
}
|
||||||
|
|
||||||
|
func makeSearchEntry() *widget.Entry {
|
||||||
|
s := widget.NewEntry()
|
||||||
|
s.SetPlaceHolder("Search phrase, comic number...")
|
||||||
|
s.Resize(fyne.Size{Height: 100})
|
||||||
|
|
||||||
|
return s
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user