mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-07 18:35:34 +00:00
example/tabs: use material.Clickable
Replace the hacked material.Buttons with Clickables for the tab areas. Signed-off-by: Elias Naur <mail@eliasnaur.com>
This commit is contained in:
@@ -5,7 +5,6 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"image"
|
"image"
|
||||||
"image/color"
|
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"gioui.org/app"
|
"gioui.org/app"
|
||||||
@@ -79,12 +78,11 @@ func drawTabs(gtx *layout.Context, th *material.Theme) {
|
|||||||
var tabWidth int
|
var tabWidth int
|
||||||
layout.Stack{Alignment: layout.S}.Layout(gtx,
|
layout.Stack{Alignment: layout.S}.Layout(gtx,
|
||||||
layout.Stacked(func() {
|
layout.Stacked(func() {
|
||||||
tabBtn := material.Button(th, t.Title)
|
material.Clickable(gtx, &t.btn, func() {
|
||||||
tabBtn.Background = color.RGBA{} // No background.
|
layout.UniformInset(unit.Sp(12)).Layout(gtx, func() {
|
||||||
tabBtn.CornerRadius = unit.Value{} // No corners.
|
material.H6(th, t.Title).Layout(gtx)
|
||||||
tabBtn.Color = color.RGBA{A: 0xff} // Black text.
|
})
|
||||||
tabBtn.TextSize = unit.Sp(20)
|
})
|
||||||
tabBtn.Layout(gtx, &t.btn)
|
|
||||||
tabWidth = gtx.Dimensions.Size.X
|
tabWidth = gtx.Dimensions.Size.X
|
||||||
}),
|
}),
|
||||||
layout.Stacked(func() {
|
layout.Stacked(func() {
|
||||||
|
|||||||
Reference in New Issue
Block a user