github.com/gop9/olt@v0.0.0-20200202132135-d956aad50b08/gio/widget/material/checkbox.go (about) 1 // SPDX-License-Identifier: Unlicense OR MIT 2 3 package material 4 5 import ( 6 "github.com/gop9/olt/gio/layout" 7 "github.com/gop9/olt/gio/text" 8 "github.com/gop9/olt/gio/unit" 9 "github.com/gop9/olt/gio/widget" 10 ) 11 12 type CheckBox struct { 13 checkable 14 } 15 16 func (t *Theme) CheckBox(label string) CheckBox { 17 return CheckBox{ 18 checkable{ 19 Label: label, 20 Color: t.Color.Text, 21 IconColor: t.Color.Primary, 22 Font: text.Font{ 23 Size: t.TextSize.Scale(14.0 / 16.0), 24 }, 25 Size: unit.Dp(26), 26 shaper: t.Shaper, 27 checkedStateIcon: t.checkBoxCheckedIcon, 28 uncheckedStateIcon: t.checkBoxUncheckedIcon, 29 }, 30 } 31 } 32 33 func (c CheckBox) Layout(gtx *layout.Context, checkBox *widget.CheckBox) { 34 c.layout(gtx, checkBox.Checked(gtx)) 35 checkBox.Layout(gtx) 36 }