chore(v2): vendor dependencies for offline/China builds
go mod vendor pins onnxruntime_go v1.12.1, Gio and the rest into v2/vendor so go run/build work without hitting proxy.golang.org (blocked/slow in China). Verified: CGO_ENABLED=1 go build -mod=vendor ./internal/spike and GOOS=windows go build -mod=vendor ./internal/ui both pass. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+49
@@ -0,0 +1,49 @@
|
||||
// SPDX-License-Identifier: Unlicense OR MIT
|
||||
|
||||
package material
|
||||
|
||||
import (
|
||||
"gioui.org/io/semantic"
|
||||
"gioui.org/layout"
|
||||
"gioui.org/widget"
|
||||
)
|
||||
|
||||
type RadioButtonStyle struct {
|
||||
checkable
|
||||
Key string
|
||||
Group *widget.Enum
|
||||
}
|
||||
|
||||
// RadioButton returns a RadioButton with a label. The key specifies
|
||||
// the value for the Enum.
|
||||
func RadioButton(th *Theme, group *widget.Enum, key, label string) RadioButtonStyle {
|
||||
r := RadioButtonStyle{
|
||||
Group: group,
|
||||
checkable: checkable{
|
||||
Label: label,
|
||||
|
||||
Color: th.Palette.Fg,
|
||||
IconColor: th.Palette.ContrastBg,
|
||||
TextSize: th.TextSize * 14.0 / 16.0,
|
||||
Size: 26,
|
||||
shaper: th.Shaper,
|
||||
checkedStateIcon: th.Icon.RadioChecked,
|
||||
uncheckedStateIcon: th.Icon.RadioUnchecked,
|
||||
},
|
||||
Key: key,
|
||||
}
|
||||
r.checkable.Font.Typeface = th.Face
|
||||
return r
|
||||
}
|
||||
|
||||
// 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 {
|
||||
semantic.RadioButton.Add(gtx.Ops)
|
||||
highlight := hovering && hovered == r.Key || focused && focus == r.Key
|
||||
return r.layout(gtx, r.Group.Value == r.Key, highlight)
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user