feat(tracker): add thin line separating the controls from the tracker

This commit is contained in:
vsariola 2021-01-09 22:54:32 +02:00
parent 6bdd212336
commit 41cd1d21f6
2 changed files with 6 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package tracker
import (
"fmt"
"image"
"image/color"
"log"
"gioui.org/layout"
@ -47,6 +48,7 @@ func (t *Tracker) Layout(gtx layout.Context) {
layout.UniformInset(unit.Dp(2)).Layout(gtx, func(gtx2 layout.Context) layout.Dimensions {
return layout.Flex{Axis: layout.Vertical}.Layout(gtx2,
layout.Rigid(t.layoutControls),
layout.Rigid(t.line(true, separatorLineColor)),
layout.Flexed(1, t.layoutTracker))
})
}
@ -190,7 +192,7 @@ func (t *Tracker) layoutControls(gtx layout.Context) layout.Dimensions {
)
}
func (t *Tracker) darkLine(horizontal bool) layout.Widget {
func (t *Tracker) line(horizontal bool, color color.RGBA) layout.Widget {
return func(gtx layout.Context) layout.Dimensions {
if horizontal {
gtx.Constraints.Min.Y = 1
@ -201,7 +203,7 @@ func (t *Tracker) darkLine(horizontal bool) layout.Widget {
}
defer op.Push(gtx.Ops).Pop()
clip.Rect{Max: gtx.Constraints.Max}.Add(gtx.Ops)
paint.FillShape(gtx.Ops, black, clip.Rect{Max: image.Pt(gtx.Constraints.Max.X, gtx.Constraints.Max.Y)}.Op())
paint.FillShape(gtx.Ops, color, clip.Rect{Max: image.Pt(gtx.Constraints.Max.X, gtx.Constraints.Max.Y)}.Op())
return layout.Dimensions{Size: gtx.Constraints.Max}
}
}

View File

@ -46,6 +46,8 @@ var backgroundColor = color.RGBA{R: 18, G: 18, B: 18, A: 255}
var labelFont = fontCollection[6].Font
var labelFontSize = unit.Px(18)
var separatorLineColor = color.RGBA{R: 97, G: 97, B: 97, A: 97}
var activeTrackColor = focusedContainerColor
var trackSurfaceColor = color.RGBA{R: 18, G: 18, B: 18, A: 18}