forked from joejulian/gio
widget/material: add missing Update calls
Without the updates, the switch and radiobutton would use stale state for layout. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -38,6 +38,7 @@ func RadioButton(th *Theme, group *widget.Enum, key, label string) RadioButtonSt
|
||||
|
||||
// Layout updates enum and displays the radio button.
|
||||
func (r RadioButtonStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
r.Group.Update(gtx)
|
||||
hovered, hovering := r.Group.Hovered()
|
||||
focus, focused := r.Group.Focused()
|
||||
return r.Group.Layout(gtx, r.Key, func(gtx layout.Context) layout.Dimensions {
|
||||
|
||||
@@ -39,6 +39,7 @@ func Switch(th *Theme, swtch *widget.Bool, description string) SwitchStyle {
|
||||
|
||||
// Layout updates the switch and displays it.
|
||||
func (s SwitchStyle) Layout(gtx layout.Context) layout.Dimensions {
|
||||
s.Switch.Update(gtx)
|
||||
trackWidth := gtx.Dp(36)
|
||||
trackHeight := gtx.Dp(16)
|
||||
thumbSize := gtx.Dp(20)
|
||||
|
||||
Reference in New Issue
Block a user