From d682e92606e7620d4be378b09b114b8014330c67 Mon Sep 17 00:00:00 2001 From: Elias Naur Date: Wed, 13 May 2020 10:23:04 +0200 Subject: [PATCH] example/tabs: use material.Clickable Replace the hacked material.Buttons with Clickables for the tab areas. Signed-off-by: Elias Naur --- example/tabs/tabs.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/example/tabs/tabs.go b/example/tabs/tabs.go index 6afcc1e7..783f17ce 100644 --- a/example/tabs/tabs.go +++ b/example/tabs/tabs.go @@ -5,7 +5,6 @@ package main import ( "fmt" "image" - "image/color" "log" "gioui.org/app" @@ -79,12 +78,11 @@ func drawTabs(gtx *layout.Context, th *material.Theme) { var tabWidth int layout.Stack{Alignment: layout.S}.Layout(gtx, layout.Stacked(func() { - tabBtn := material.Button(th, t.Title) - tabBtn.Background = color.RGBA{} // No background. - tabBtn.CornerRadius = unit.Value{} // No corners. - tabBtn.Color = color.RGBA{A: 0xff} // Black text. - tabBtn.TextSize = unit.Sp(20) - tabBtn.Layout(gtx, &t.btn) + material.Clickable(gtx, &t.btn, func() { + layout.UniformInset(unit.Sp(12)).Layout(gtx, func() { + material.H6(th, t.Title).Layout(gtx) + }) + }) tabWidth = gtx.Dimensions.Size.X }), layout.Stacked(func() {