mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-06 09:55:40 +00:00
widget/material: respect height minimum constraint in Button.Layout
Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -82,13 +82,17 @@ func (b Button) Layout(gtx *layout.Context, button *widget.Button) {
|
|||||||
col = rgb(0x888888)
|
col = rgb(0x888888)
|
||||||
bgcol = rgb(0xcccccc)
|
bgcol = rgb(0xcccccc)
|
||||||
}
|
}
|
||||||
st := layout.Stack{}
|
st := layout.Stack{Alignment: layout.Center}
|
||||||
min := gtx.Constraints.Width.Min
|
hmin := gtx.Constraints.Width.Min
|
||||||
|
vmin := gtx.Constraints.Height.Min
|
||||||
lbl := st.Rigid(gtx, func() {
|
lbl := st.Rigid(gtx, func() {
|
||||||
gtx.Constraints.Width.Min = min
|
gtx.Constraints.Width.Min = hmin
|
||||||
layout.UniformInset(unit.Dp(16)).Layout(gtx, func() {
|
gtx.Constraints.Height.Min = vmin
|
||||||
paint.ColorOp{Color: col}.Add(gtx.Ops)
|
layout.Align(layout.Center).Layout(gtx, func() {
|
||||||
widget.Label{Alignment: text.Middle}.Layout(gtx, b.shaper, b.Font, b.Text)
|
layout.UniformInset(unit.Dp(16)).Layout(gtx, func() {
|
||||||
|
paint.ColorOp{Color: col}.Add(gtx.Ops)
|
||||||
|
widget.Label{}.Layout(gtx, b.shaper, b.Font, b.Text)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
pointer.RectAreaOp{Rect: image.Rectangle{Max: gtx.Dimensions.Size}}.Add(gtx.Ops)
|
pointer.RectAreaOp{Rect: image.Rectangle{Max: gtx.Dimensions.Size}}.Add(gtx.Ops)
|
||||||
button.Layout(gtx)
|
button.Layout(gtx)
|
||||||
|
|||||||
Reference in New Issue
Block a user