widget/material: allow configuring default typeface on theme

This commit introduces the material.Theme.Face field, which will automatically
populate the Font.Typeface in every text widget created using a constructor function
in package material.

Signed-off-by: Chris Waldon <christopher.waldon.dev@gmail.com>
This commit is contained in:
Chris Waldon
2023-06-22 15:06:22 -04:00
committed by Elias Naur
parent 6384ab6087
commit acab582487
6 changed files with 19 additions and 5 deletions
+3 -1
View File
@@ -14,7 +14,7 @@ type CheckBoxStyle struct {
}
func CheckBox(th *Theme, checkBox *widget.Bool, label string) CheckBoxStyle {
return CheckBoxStyle{
c := CheckBoxStyle{
CheckBox: checkBox,
checkable: checkable{
Label: label,
@@ -27,6 +27,8 @@ func CheckBox(th *Theme, checkBox *widget.Bool, label string) CheckBoxStyle {
uncheckedStateIcon: th.Icon.CheckBoxUnchecked,
},
}
c.checkable.Font.Typeface = th.Face
return c
}
// Layout updates the checkBox and displays it.