From de7a5985d5a690a7ba91326afe1d3d858cbc183f Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 3 Mar 2021 17:32:31 +0100 Subject: [PATCH] widget/material: remove bogus minimum cosntraint from checkable checkable.layout forces the label to take up at least constraints.min space. However, for min == max, the total checkbox plus label would then overflow. The minimum constraint doesn't seem necessary anymore, so drop it. Remove a superfluous layout.W layout as well. Signed-off-by: Elias Naur --- widget/material/checkable.go | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/widget/material/checkable.go b/widget/material/checkable.go index 2c3dc838..8fca34e6 100644 --- a/widget/material/checkable.go +++ b/widget/material/checkable.go @@ -38,7 +38,6 @@ func (c *checkable) layout(gtx layout.Context, checked, hovered bool) layout.Dim icon = c.uncheckedStateIcon } - min := gtx.Constraints.Min dims := layout.Flex{Alignment: layout.Middle}.Layout(gtx, layout.Rigid(func(gtx layout.Context) layout.Dimensions { return layout.Stack{Alignment: layout.Center}.Layout(gtx, @@ -77,12 +76,9 @@ func (c *checkable) layout(gtx layout.Context, checked, hovered bool) layout.Dim }), layout.Rigid(func(gtx layout.Context) layout.Dimensions { - gtx.Constraints.Min = min - return layout.W.Layout(gtx, func(gtx layout.Context) layout.Dimensions { - return layout.UniformInset(unit.Dp(2)).Layout(gtx, func(gtx layout.Context) layout.Dimensions { - paint.ColorOp{Color: c.Color}.Add(gtx.Ops) - return widget.Label{}.Layout(gtx, c.shaper, c.Font, c.TextSize, c.Label) - }) + return layout.UniformInset(unit.Dp(2)).Layout(gtx, func(gtx layout.Context) layout.Dimensions { + paint.ColorOp{Color: c.Color}.Add(gtx.Ops) + return widget.Label{}.Layout(gtx, c.shaper, c.Font, c.TextSize, c.Label) }) }), )