widget/material: fix IconButton padding

Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
Elias Naur
2019-10-21 09:34:26 +02:00
parent 78963bdaae
commit 86f45f813e
+2 -2
View File
@@ -71,7 +71,7 @@ func (t *Theme) IconButton(icon *Icon) IconButton {
Background: t.Color.Primary, Background: t.Color.Primary,
Icon: icon, Icon: icon,
Size: unit.Dp(56), Size: unit.Dp(56),
Padding: unit.Dp(20), Padding: unit.Dp(16),
} }
} }
@@ -110,7 +110,7 @@ func (b IconButton) Layout(gtx *layout.Context, button *widget.Button) {
st := layout.Stack{} st := layout.Stack{}
ico := st.Rigid(gtx, func() { ico := st.Rigid(gtx, func() {
layout.UniformInset(b.Padding).Layout(gtx, func() { layout.UniformInset(b.Padding).Layout(gtx, func() {
size := gtx.Px(b.Size) - gtx.Px(b.Padding) size := gtx.Px(b.Size) - 2*gtx.Px(b.Padding)
if b.Icon != nil { if b.Icon != nil {
b.Icon.Layout(gtx, unit.Px(float32(size))) b.Icon.Layout(gtx, unit.Px(float32(size)))
} }