Skip to content

Commit

Permalink
Tweaking padding and alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
andydotxyz committed Mar 26, 2024
1 parent 720f616 commit ef0c3cd
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 4 deletions.
Binary file removed cmd/fyne-x/fyne-x.tar.xz
Binary file not shown.
Binary file removed cmd/fyne-x/usr/local/bin/fyne-x
Binary file not shown.
21 changes: 17 additions & 4 deletions dialog/about.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
// You should call Show on the returned dialog to display it.
func NewAbout(content string, links []*widget.Hyperlink, a fyne.App, w fyne.Window) dialog.Dialog {
d := dialog.NewCustom("About", "OK", aboutContent(content, links, a), w)
d.Resize(fyne.NewSize(400, 320))
d.Resize(fyne.NewSize(400, 360))

return d
}
Expand All @@ -28,7 +28,7 @@ func NewAbout(content string, links []*widget.Hyperlink, a fyne.App, w fyne.Wind
func NewAboutWindow(content string, links []*widget.Hyperlink, a fyne.App) fyne.Window {
w := a.NewWindow("About")
w.SetContent(aboutContent(content, links, a))
w.Resize(fyne.NewSize(360, 280))
w.Resize(fyne.NewSize(360, 300))

return w
}
Expand All @@ -55,10 +55,15 @@ func aboutContent(content string, links []*widget.Hyperlink, a fyne.App) fyne.Ca
logo.FillMode = canvas.ImageFillContain
logo.SetMinSize(fyne.NewSize(128, 128))

appData := widget.NewRichTextFromMarkdown(
"## " + a.Metadata().Name + "\n**Version:** " + a.Metadata().Version)
centerText(appData)
space := canvas.NewRectangle(color.Transparent)
space.SetMinSize(fyne.NewSquareSize(theme.Padding() * 4))
body := container.NewVBox(
space,
logo,
container.NewCenter(widget.NewRichTextFromMarkdown(
"## "+a.Metadata().Name+"\n**Version:** "+a.Metadata().Version)),
appData,
container.NewCenter(rich))
scroll := container.NewScroll(body)

Expand Down Expand Up @@ -99,6 +104,14 @@ func aboutFooter(links []*widget.Hyperlink) fyne.CanvasObject {
return footer
}

func centerText(rich *widget.RichText) {
for _, s := range rich.Segments {
if text, ok := s.(*widget.TextSegment); ok {
text.Style.Alignment = fyne.TextAlignCenter
}
}
}

func watchTheme(bg, footer *canvas.Rectangle, a fyne.App) {
listen := make(chan fyne.Settings)
fyne.CurrentApp().Settings().AddChangeListener(listen)
Expand Down
Binary file modified img/about-dialog.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/about.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit ef0c3cd

Please sign in to comment.