2024-03-30 17:45:07 +01:00
|
|
|
package uiwidget
|
|
|
|
|
|
|
|
import (
|
|
|
|
"image/color"
|
|
|
|
|
|
|
|
"fyne.io/fyne/v2"
|
|
|
|
"fyne.io/fyne/v2/canvas"
|
|
|
|
"fyne.io/fyne/v2/container"
|
|
|
|
"fyne.io/fyne/v2/theme"
|
|
|
|
)
|
|
|
|
|
2024-04-03 16:07:24 +02:00
|
|
|
// NewWidgetBorder creates a new widget border for the given fyne.CanvasObject.
|
|
|
|
// It does so by wrapping the object in a Stack layout with a border drawn
|
|
|
|
// above the widget.
|
2024-03-30 17:45:07 +01:00
|
|
|
func NewWidgetBorder(widget fyne.CanvasObject) fyne.CanvasObject {
|
|
|
|
b := canvas.NewRectangle(color.Transparent)
|
|
|
|
b.StrokeColor = theme.InputBorderColor()
|
|
|
|
b.StrokeWidth = theme.InputBorderSize()
|
|
|
|
b.CornerRadius = theme.InputRadiusSize()
|
|
|
|
l := container.NewStack(widget, b)
|
|
|
|
return l
|
|
|
|
}
|