23 lines
606 B
Go
23 lines
606 B
Go
package uiwidget
|
|
|
|
import (
|
|
"image/color"
|
|
|
|
"fyne.io/fyne/v2"
|
|
"fyne.io/fyne/v2/canvas"
|
|
"fyne.io/fyne/v2/container"
|
|
"fyne.io/fyne/v2/theme"
|
|
)
|
|
|
|
// 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.
|
|
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
|
|
}
|