~eliasnaur/gio-patches

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH v2] widget/material: allow button Inset to be customizable

Details
Message ID
<20200217142919.18874-1-larry@theclapp.org>
DKIM signature
missing
Download raw message
Patch: +8 -2
Signed-off-by: Larry Clapp <larry@theclapp.org>
---
 widget/material/button.go | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

Commentary: Not really v2, just a resend.

diff --git a/widget/material/button.go b/widget/material/button.go
index ba9c8e6..562cf5e 100644
--- a/widget/material/button.go
+++ b/widget/material/button.go
@@ -25,6 +25,7 @@ type Button struct {
	TextSize     unit.Value
	Background   color.RGBA
	CornerRadius unit.Value
	Inset        layout.Inset
	shaper       text.Shaper
}

@@ -34,6 +35,7 @@ type IconButton struct {
	Icon       *Icon
	Size       unit.Value
	Padding    unit.Value
	Inset      layout.Inset
}

func (t *Theme) Button(txt string) Button {
@@ -42,7 +44,11 @@ func (t *Theme) Button(txt string) Button {
		Color:      rgb(0xffffff),
		Background: t.Color.Primary,
		TextSize:   t.TextSize.Scale(14.0 / 16.0),
		shaper:     t.Shaper,
		Inset: layout.Inset{
			Top: unit.Dp(10), Bottom: unit.Dp(10),
			Left: unit.Dp(12), Right: unit.Dp(12),
		},
		shaper: t.Shaper,
	}
}

@@ -80,7 +86,7 @@ func (b Button) Layout(gtx *layout.Context, button *widget.Button) {
			gtx.Constraints.Width.Min = hmin
			gtx.Constraints.Height.Min = vmin
			layout.Center.Layout(gtx, func() {
				layout.Inset{Top: unit.Dp(10), Bottom: unit.Dp(10), Left: unit.Dp(12), Right: unit.Dp(12)}.Layout(gtx, func() {
				b.Inset.Layout(gtx, func() {
					paint.ColorOp{Color: col}.Add(gtx.Ops)
					widget.Label{}.Layout(gtx, b.shaper, b.Font, b.TextSize, b.Text)
				})
-- 
2.25.0
Details
Message ID
<C0OIKGRN0T0Y.D9CZ1GAJKBDS@toolbox>
In-Reply-To
<20200217142919.18874-1-larry@theclapp.org> (view parent)
DKIM signature
missing
Download raw message
Applied. Thank you.