2021-12-24 00:00:44 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
|
|
|
"fmt"
|
|
|
|
"image"
|
2021-12-24 12:32:03 +00:00
|
|
|
"image/color"
|
2021-12-24 00:00:44 +00:00
|
|
|
|
|
|
|
"fyne.io/fyne/v2"
|
|
|
|
"fyne.io/fyne/v2/app"
|
|
|
|
"fyne.io/fyne/v2/container"
|
|
|
|
|
|
|
|
"git.martyn.berlin/martyn/fyne-widgets/pkg/profilebtn"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
a := app.New()
|
|
|
|
w := a.NewWindow("ProfileBtn")
|
|
|
|
b := profilebtn.NewProfileBtn()
|
|
|
|
i, s, err := image.Decode(bytes.NewReader(resourceProfilepicdoesnotexistJpg.StaticContent))
|
|
|
|
fmt.Println(s)
|
|
|
|
if err != nil {
|
|
|
|
fmt.Println(err)
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
fmt.Println(i.Bounds())
|
|
|
|
b.SetProfileImage(i)
|
|
|
|
b.OutlineWidth = 5
|
2021-12-24 12:32:03 +00:00
|
|
|
b2 := profilebtn.NewProfileBtn()
|
|
|
|
b2.SetProfileResource(resourceProfilepicdoesnotexistJpg)
|
|
|
|
b2.OutlineWidth = 3
|
|
|
|
b3 := profilebtn.NewProfileBtn()
|
|
|
|
b3.OutlineColor = color.RGBA{0x4f, 0, 0xfc, 0xff}
|
|
|
|
w.SetContent(container.NewBorder(container.NewHBox(b2, b3), nil, nil, nil, b))
|
2021-12-24 00:00:44 +00:00
|
|
|
w.Resize(fyne.NewSize(640, 480))
|
|
|
|
w.ShowAndRun()
|
|
|
|
}
|