From d4cc70e5a8d06ea6b839fe7d138d53cbf756848c Mon Sep 17 00:00:00 2001 From: Chris Waldon Date: Tue, 27 Aug 2024 21:49:34 -0400 Subject: [PATCH] component: allow specifying discloser control and summary alignment Signed-off-by: Chris Waldon --- component/discloser.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/component/discloser.go b/component/discloser.go index 521a857..bd35c16 100644 --- a/component/discloser.go +++ b/component/discloser.go @@ -49,12 +49,16 @@ type DiscloserStyle struct { // ControlSide defines whether the control widget is drawn to the // left or right of the summary widget. ControlSide Side + // Alignment dictates how the control and summary are aligned relative + // to one another. + Alignment layout.Alignment } // Discloser configures a discloser from the provided theme and state. func Discloser(th *material.Theme, state *DiscloserState) DiscloserStyle { return DiscloserStyle{ DiscloserState: state, + Alignment: layout.Middle, } } @@ -80,7 +84,7 @@ func (d DiscloserStyle) Layout(gtx C, control, summary, detail layout.Widget) D return d.Clickable.Layout(gtx, control) } return layout.Flex{ - Alignment: layout.Middle, + Alignment: d.Alignment, }.Layout(gtx, layout.Rigid(func(gtx C) D { if d.ControlSide == Left { -- 2.45.2