example: add widget.Border example

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2020-07-09 19:16:23 +02:00
parent c76b42e486
commit 39550f3239
3 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ module gioui.org/example
go 1.13
require (
gioui.org v0.0.0-20200709163300-d572aa23ac36
gioui.org v0.0.0-20200709175537-c76b42e48698
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7
github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72
github.com/google/go-github/v24 v24.0.1
+2 -2
View File
@@ -1,7 +1,7 @@
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
gioui.org v0.0.0-20200709163300-d572aa23ac36 h1:Z02IZg+1zaHZtkVpIhd9+oxMfq1TwuuboC6gm9GdAbI=
gioui.org v0.0.0-20200709163300-d572aa23ac36/go.mod h1:jiUwifN9cRl/zmco43aAqh0aV+s9GbhG13KcD+gEpkU=
gioui.org v0.0.0-20200709175537-c76b42e48698 h1:3lg2Rg3UGFfyDO5rM8Ouvfb7wyPo0ipj7jcyQfIBFhE=
gioui.org v0.0.0-20200709175537-c76b42e48698/go.mod h1:jiUwifN9cRl/zmco43aAqh0aV+s9GbhG13KcD+gEpkU=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7 h1:SCYMcCJ89LjRGwEa0tRluNRiMjZHalQZrVrvTbPh+qw=
github.com/go-gl/gl v0.0.0-20190320180904-bf2b1f2f34d7/go.mod h1:482civXOzJJCPzJ4ZOX/pwvXBWSnzD4OKMdH4ClKGbk=
+4 -1
View File
@@ -256,7 +256,10 @@ func kitchen(gtx layout.Context, th *material.Theme) layout.Dimensions {
func(gtx C) D {
e := material.Editor(th, lineEditor, "Hint")
e.Font.Style = text.Italic
return e.Layout(gtx)
border := widget.Border{Color: color.RGBA{A: 0xff}, CornerRadius: unit.Dp(10), Width: unit.Px(2)}
return border.Layout(gtx, func(gtx C) D {
return layout.UniformInset(unit.Dp(8)).Layout(gtx, e.Layout)
})
},
func(gtx C) D {
in := layout.UniformInset(unit.Dp(8))