package main

import (
	"bytes"
	"image"
	"image/color"

	"fyne.io/fyne/v2"
	"fyne.io/fyne/v2/app"
	"fyne.io/fyne/v2/container"
	"fyne.io/fyne/v2/dialog"

	"git.martyn.berlin/martyn/fyne-widgets/pkg/profilebtn"
)

var w fyne.Window

func Pressed() {
	i := dialog.NewInformation("You clicked!", "You clicked the button", w)
	i.Show()
}

func main() {
	a := app.New()
	w = a.NewWindow("ProfileBtn")
	b := profilebtn.NewProfileBtn()
	i, _, err := image.Decode(bytes.NewReader(resourceProfilepicdoesnotexistJpg.StaticContent))
	if err != nil {
		panic(err)
	}
	b.SetProfileImage(i)
	b.OutlineWidth = 5
	b2 := profilebtn.NewProfileBtn()
	b2.SetProfileResource(resourceProfilepicdoesnotexistJpg)
	b2.OutlineWidth = 3
	b3 := profilebtn.NewProfileBtn()
	b3.OutlineColor = color.RGBA{0x4f, 0, 0xfc, 0xff}
	b3.OnTapped = Pressed
	b3.SetMinSize(fyne.NewSize(40, 40))
	b3.Refresh()
	w.SetContent(container.NewBorder(container.NewHBox(b2, b3), nil, nil, nil, b))
	w.Resize(fyne.NewSize(640, 480))
	w.ShowAndRun()
}
