@@ 99,7 99,7 @@ type threadsPage struct {
account *Account
fab *widget.Button
- fabIcon *material.Icon
+ fabIcon *widget.Icon
updates <-chan struct{}
threadUpdates chan []*Thread
@@ 167,8 167,8 @@ type ShowThreadEvent struct {
var theme *material.Theme
var iconLib struct {
- create *material.Icon
- send *material.Icon
+ create *widget.Icon
+ send *widget.Icon
}
func uiMain() {
@@ 189,8 189,8 @@ func uiMain() {
app.Main()
}
-func mustIcon(data []byte) *material.Icon {
- ico, err := material.NewIcon(data)
+func mustIcon(data []byte) *widget.Icon {
+ ico, err := widget.NewIcon(data)
if err != nil {
log.Fatal(err)
}
@@ 425,7 425,7 @@ func (a *App) layoutTimings(gtx *layout.Context) {
in.Top = unit.Max(gtx, unit.Dp(16), in.Top)
in.Layout(gtx, func() {
txt := fmt.Sprintf("m: %d %s", mallocs, a.profile.Timings)
- lbl := theme.Caption(txt)
+ lbl := material.Caption(theme, txt)
lbl.Font.Variant = "Mono"
lbl.Layout(gtx)
})
@@ 513,7 513,7 @@ func (p *contactsPage) Layout(gtx *layout.Context) {
layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func() {
p.topbar.Layout(gtx, p.env.insets, func() {
- e := theme.Editor("Email address")
+ e := material.Editor(theme, "Email address")
e.TextSize = unit.Sp(20)
e.Color = rgb(0xffffff)
e.HintColor = rgb(0xbbbbbb)
@@ 552,7 552,7 @@ func (p *contactsPage) contact(gtx *layout.Context, index int) {
})
}),
layout.Flexed(1, func() {
- theme.H6(contact.Address).Layout(gtx)
+ material.H6(theme, contact.Address).Layout(gtx)
}),
)
})
@@ 614,10 614,10 @@ func newSignInPage(env *Env) *signInPage {
Axis: layout.Vertical,
},
fields: []*formField{
- &formField{Header: "Email address", Hint: "you@example.org", Value: &acc.User},
- &formField{Header: "Password", Hint: "correct horse battery staple", Value: &acc.Password},
- &formField{Header: "IMAP host", Hint: "host:port", Value: &acc.IMAPHost},
- &formField{Header: "SMTP host", Hint: "host:port", Value: &acc.SMTPHost},
+ {Header: "Email address", Hint: "you@example.org", Value: &acc.User},
+ {Header: "Password", Hint: "correct horse battery staple", Value: &acc.Password},
+ {Header: "IMAP host", Hint: "host:port", Value: &acc.IMAPHost},
+ {Header: "SMTP host", Hint: "host:port", Value: &acc.SMTPHost},
},
submit: &widget.Button{},
}
@@ 649,7 649,7 @@ func (p *signInPage) Layout(gtx *layout.Context) {
layout.Rigid(func() {
var t Topbar
t.Layout(gtx, p.env.insets, func() {
- lbl := theme.H6("Sign in")
+ lbl := material.H6(theme, "Sign in")
lbl.Color = rgb(0xffffff)
lbl.Layout(gtx)
})
@@ 681,7 681,7 @@ func (p *signInPage) layoutSigninForm(gtx *layout.Context) {
in.Bottom = unit.Max(gtx, unit.Dp(32), p.env.insets.Bottom)
layout.E.Layout(gtx, func() {
in.Layout(gtx, func() {
- theme.Button("Sign in").Layout(gtx, p.submit)
+ material.Button(theme, "Sign in").Layout(gtx, p.submit)
})
})
}
@@ 692,13 692,13 @@ func (f *formField) Layout(gtx *layout.Context) {
layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func() {
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
- header := theme.Caption(f.Header)
+ header := material.Caption(theme, f.Header)
header.Font.Weight = text.Bold
header.Layout(gtx)
gtx.Dimensions.Size.Y += gtx.Px(unit.Dp(4))
}),
layout.Rigid(func() {
- theme.Editor(f.Hint).Layout(gtx, f.edit)
+ material.Editor(theme, f.Hint).Layout(gtx, f.edit)
}),
)
}
@@ 802,7 802,7 @@ func (p *threadsPage) Layout(gtx *layout.Context) {
layout.Rigid(func() {
var t Topbar
t.Layout(gtx, p.env.insets, func() {
- lbl := theme.H6(p.account.User)
+ lbl := material.H6(theme, p.account.User)
lbl.Color = rgb(0xffffff)
lbl.Layout(gtx)
})
@@ 819,7 819,7 @@ func (p *threadsPage) Layout(gtx *layout.Context) {
Right: unit.Max(gtx, unit.Dp(16), p.env.insets.Right),
Bottom: unit.Max(gtx, unit.Dp(16), p.env.insets.Bottom),
}.Layout(gtx, func() {
- theme.IconButton(iconLib.create).Layout(gtx, p.fab)
+ material.IconButton(theme, iconLib.create).Layout(gtx, p.fab)
})
})
}),
@@ 891,7 891,7 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
initial = string(unicode.ToUpper(c))
break
}
- lbl := theme.H5(initial)
+ lbl := material.H5(theme, initial)
lbl.Color = rgb(0xffffff)
lbl.Layout(gtx)
}),
@@ 904,7 904,7 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
layout.Rigid(func() {
baseline().Layout(gtx,
layout.Rigid(func() {
- lbl := theme.H6(t.ID)
+ lbl := material.H6(theme, t.ID)
lbl.Font.Weight = fontWeight
lbl.Layout(gtx)
}),
@@ 912,7 912,7 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
in := layout.Inset{Left: unit.Dp(2)}
in.Layout(gtx, func() {
- lbl := theme.Caption(formatTime(t.Updated))
+ lbl := material.Caption(theme, formatTime(t.Updated))
lbl.Color = bgtexcol
lbl.Alignment = text.End
lbl.Font.Weight = fontWeight
@@ 924,7 924,7 @@ func (p *threadsPage) thread(gtx *layout.Context, index int) {
layout.Rigid(func() {
in := layout.Inset{Top: unit.Dp(6)}
in.Layout(gtx, func() {
- lbl := theme.Body2(t.Snippet)
+ lbl := material.Body2(theme, t.Snippet)
lbl.Color = bgtexcol
lbl.Font.Weight = fontWeight
lbl.MaxLines = 1
@@ 1021,7 1021,7 @@ func (p *threadPage) Layout(gtx *layout.Context) {
layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func() {
p.topbar.Layout(gtx, p.env.insets, func() {
- lbl := theme.H6(p.thread.ID)
+ lbl := material.H6(theme, p.thread.ID)
lbl.Color = rgb(0xffffff)
lbl.Layout(gtx)
})
@@ 1044,11 1044,11 @@ func (p *threadPage) Layout(gtx *layout.Context) {
in.Layout(gtx, func() {
switch {
case p.thread.PendingInvitation:
- theme.Button("Accept invitation").Layout(gtx, p.accept)
+ material.Button(theme, "Accept invitation").Layout(gtx, p.accept)
case p.env.client.ContainsSession(p.thread.ID):
p.layoutMessageBox(gtx)
default:
- theme.Button("Send invitation").Layout(gtx, p.invite)
+ material.Button(theme, "Send invitation").Layout(gtx, p.invite)
}
})
}),
@@ 1075,7 1075,7 @@ func (p *threadPage) layoutMessageBox(gtx *layout.Context) {
bg.Layout(gtx, func() {
layout.W.Layout(gtx, func() {
gtx.Constraints.Width.Min = gtx.Constraints.Width.Max
- ed := theme.Editor("Send a message")
+ ed := material.Editor(theme, "Send a message")
ed.TextSize = unit.Sp(14)
ed.Layout(gtx, p.msgEdit)
})
@@ 1084,7 1084,7 @@ func (p *threadPage) layoutMessageBox(gtx *layout.Context) {
layout.Rigid(func() {
in := layout.Inset{Left: unit.Dp(8)}
in.Layout(gtx, func() {
- btn := theme.IconButton(iconLib.send)
+ btn := material.IconButton(theme, iconLib.send)
btn.Size = unit.Dp(48)
btn.Padding = unit.Dp(12)
btn.Layout(gtx, p.send)
@@ 1121,7 1121,7 @@ func (p *threadPage) message(gtx *layout.Context, index int) {
var msgWidth int
layout.Flex{Axis: layout.Vertical}.Layout(gtx,
layout.Rigid(func() {
- lbl := theme.Body2(msg.Message)
+ lbl := material.Body2(theme, msg.Message)
lbl.Color = msgCol
lbl.Layout(gtx)
gtx.Dimensions.Size.Y += gtx.Px(unit.Dp(4))
@@ 1135,7 1135,7 @@ func (p *threadPage) message(gtx *layout.Context, index int) {
var children []layout.FlexChild
child := layout.Rigid(func() {
time := formatTime(msg.Time)
- lbl := theme.Caption(time)
+ lbl := material.Caption(theme, time)
lbl.Color = timecol
lbl.Layout(gtx)
})