From c32b3fe43a46c563406a79275919c4336b87bc44 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Mon, 11 May 2020 11:29:05 +0200 Subject: [PATCH] widget/material: drop Color from ButtonLayoutStyle Setting a ColorOp before calling a widget function is too subtle. Let the widget manage its color instead. Signed-off-by: Elias Naur --- widget/material/button.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/widget/material/button.go b/widget/material/button.go index 98dc6807..03878d90 100644 --- a/widget/material/button.go +++ b/widget/material/button.go @@ -31,7 +31,6 @@ type ButtonStyle struct { type ButtonLayoutStyle struct { Background color.RGBA - Color color.RGBA CornerRadius unit.Value Inset layout.Inset } @@ -63,7 +62,6 @@ func Button(th *Theme, txt string) ButtonStyle { func ButtonLayout(th *Theme) ButtonLayoutStyle { return ButtonLayoutStyle{ Background: th.Color.Primary, - Color: th.Color.InvText, CornerRadius: unit.Dp(4), Inset: layout.UniformInset(unit.Dp(12)), } @@ -83,9 +81,9 @@ func (b ButtonStyle) Layout(gtx *layout.Context, button *widget.Button) { ButtonLayoutStyle{ Background: b.Background, CornerRadius: b.CornerRadius, - Color: b.Color, Inset: b.Inset, }.Layout(gtx, button, func() { + paint.ColorOp{Color: b.Color}.Add(gtx.Ops) widget.Label{Alignment: text.Middle}.Layout(gtx, b.shaper, b.Font, b.TextSize, b.Text) }) } @@ -113,7 +111,6 @@ func (b ButtonLayoutStyle) Layout(gtx *layout.Context, button *widget.Button, w gtx.Constraints.Height.Min = vmin layout.Center.Layout(gtx, func() { b.Inset.Layout(gtx, func() { - paint.ColorOp{Color: b.Color}.Add(gtx.Ops) w() }) })