material

package
v1.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2026 License: MIT, Unlicense Imports: 18 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clickable

func Clickable(gtx layout.Context, button *widget.Clickable, w layout.Widget) layout.Dimensions

Clickable lays out a pressable/focusable region with the hover/focus highlight but without the Material ink (ripple) press animation. Use ClickableInk to opt back in to the ripple.

func ClickableInk added in v1.2.16

func ClickableInk(gtx layout.Context, button *widget.Clickable, w layout.Widget) layout.Dimensions

ClickableInk behaves like Clickable but also renders the Material ink (ripple) press animation.

Types

type AnchorStrategy

type AnchorStrategy uint8
const (
	Occupy AnchorStrategy = iota

	Overlay
)

type ButtonLayoutStyle

type ButtonLayoutStyle struct {
	Background   color.NRGBA
	CornerRadius unit.Dp
	Button       *widget.Clickable
	// Ink enables the Material ink (ripple) press animation (off by default).
	Ink bool
}

func ButtonLayout

func ButtonLayout(th *Theme, button *widget.Clickable) ButtonLayoutStyle

func (ButtonLayoutStyle) Layout

type ButtonStyle

type ButtonStyle struct {
	Text string

	Color        color.NRGBA
	Font         font.Font
	TextSize     unit.Sp
	Background   color.NRGBA
	CornerRadius unit.Dp
	Inset        layout.Inset
	Button       *widget.Clickable
	// Ink enables the Material ink (ripple) press animation. It is off by
	// default; set it to true at construction to opt a button back in.
	Ink bool
	// contains filtered or unexported fields
}

func Button

func Button(th *Theme, button *widget.Clickable, txt string) ButtonStyle

func (ButtonStyle) Layout

func (b ButtonStyle) Layout(gtx layout.Context) layout.Dimensions

type CheckBoxStyle

type CheckBoxStyle struct {
	CheckBox *widget.Bool
	// contains filtered or unexported fields
}

func CheckBox

func CheckBox(th *Theme, checkBox *widget.Bool, label string) CheckBoxStyle

func (CheckBoxStyle) Layout

type DecorationsStyle

type DecorationsStyle struct {
	Decorations *widget.Decorations
	Actions     system.Action
	Title       LabelStyle
	Background  color.NRGBA
	Foreground  color.NRGBA
}

func Decorations

func Decorations(th *Theme, deco *widget.Decorations, actions system.Action, title string) DecorationsStyle

func (DecorationsStyle) Layout

type EditorStyle

type EditorStyle struct {
	Font font.Font

	LineHeight unit.Sp

	LineHeightScale float32
	TextSize        unit.Sp

	Color color.NRGBA

	Hint string

	HintColor color.NRGBA

	SelectionColor color.NRGBA
	Editor         *widget.Editor
	// contains filtered or unexported fields
}

func Editor

func Editor(th *Theme, editor *widget.Editor, hint string) EditorStyle

func (EditorStyle) Layout

func (e EditorStyle) Layout(gtx layout.Context) layout.Dimensions

type IconButtonStyle

type IconButtonStyle struct {
	Background color.NRGBA

	Color color.NRGBA
	Icon  *widget.Icon

	Size        unit.Dp
	Inset       layout.Inset
	Button      *widget.Clickable
	Description string
	// Ink enables the Material ink (ripple) press animation (off by default).
	Ink bool
}

func IconButton

func IconButton(th *Theme, button *widget.Clickable, icon *widget.Icon, description string) IconButtonStyle

func (IconButtonStyle) Layout

type LabelStyle

type LabelStyle struct {
	Font font.Font

	Color color.NRGBA

	SelectionColor color.NRGBA

	Alignment text.Alignment

	MaxLines int

	WrapPolicy text.WrapPolicy

	Truncator string

	Text string

	TextSize unit.Sp

	LineHeight unit.Sp

	LineHeightScale float32

	Shaper *text.Shaper

	State *widget.Selectable
}

func Body1

func Body1(th *Theme, txt string) LabelStyle

func Body2

func Body2(th *Theme, txt string) LabelStyle

func Caption

func Caption(th *Theme, txt string) LabelStyle

func H1

func H1(th *Theme, txt string) LabelStyle

func H2

func H2(th *Theme, txt string) LabelStyle

func H3

func H3(th *Theme, txt string) LabelStyle

func H4

func H4(th *Theme, txt string) LabelStyle

func H5

func H5(th *Theme, txt string) LabelStyle

func H6

func H6(th *Theme, txt string) LabelStyle

func Label

func Label(th *Theme, size unit.Sp, txt string) LabelStyle

func Overline

func Overline(th *Theme, txt string) LabelStyle

func Subtitle1

func Subtitle1(th *Theme, txt string) LabelStyle

func Subtitle2

func Subtitle2(th *Theme, txt string) LabelStyle

func (LabelStyle) Layout

func (l LabelStyle) Layout(gtx layout.Context) layout.Dimensions

type ListStyle

type ListStyle struct {
	ScrollbarStyle
	AnchorStrategy
	// contains filtered or unexported fields
}

func List

func List(th *Theme, state *widget.List) ListStyle

func (ListStyle) Layout

func (l ListStyle) Layout(gtx layout.Context, length int, w layout.ListElement) layout.Dimensions

func (ListStyle) LayoutWidgets

func (l ListStyle) LayoutWidgets(gtx layout.Context, widgets ...layout.Widget) layout.Dimensions

type LoaderStyle

type LoaderStyle struct {
	Color color.NRGBA
}

func Loader

func Loader(th *Theme) LoaderStyle

func (LoaderStyle) Layout

func (l LoaderStyle) Layout(gtx layout.Context) layout.Dimensions

type Palette

type Palette struct {
	Bg color.NRGBA

	Fg color.NRGBA

	ContrastBg color.NRGBA

	ContrastFg color.NRGBA
}

type ProgressBarStyle

type ProgressBarStyle struct {
	Color      color.NRGBA
	Height     unit.Dp
	Radius     unit.Dp
	TrackColor color.NRGBA
	Progress   float32
}

func ProgressBar

func ProgressBar(th *Theme, progress float32) ProgressBarStyle

func (ProgressBarStyle) Layout

type ProgressCircleStyle

type ProgressCircleStyle struct {
	Color    color.NRGBA
	Progress float32
}

func ProgressCircle

func ProgressCircle(th *Theme, progress float32) ProgressCircleStyle

func (ProgressCircleStyle) Layout

type RadioButtonStyle

type RadioButtonStyle struct {
	Key   string
	Group *widget.Enum
	// contains filtered or unexported fields
}

func RadioButton

func RadioButton(th *Theme, group *widget.Enum, key, label string) RadioButtonStyle

func (RadioButtonStyle) Layout

type ScrollIndicatorStyle

type ScrollIndicatorStyle struct {
	MajorMinLen unit.Dp

	MinorWidth unit.Dp

	Color, HoverColor color.NRGBA

	CornerRadius unit.Dp
}

type ScrollTrackStyle

type ScrollTrackStyle struct {
	MajorPadding, MinorPadding unit.Dp

	Color color.NRGBA
}

type ScrollbarStyle

type ScrollbarStyle struct {
	Scrollbar *widget.Scrollbar
	Track     ScrollTrackStyle
	Indicator ScrollIndicatorStyle
}

func Scrollbar

func Scrollbar(th *Theme, state *widget.Scrollbar) ScrollbarStyle

func (ScrollbarStyle) Layout

func (s ScrollbarStyle) Layout(gtx layout.Context, axis layout.Axis, viewportStart, viewportEnd float32) layout.Dimensions

func (ScrollbarStyle) Width

func (s ScrollbarStyle) Width() unit.Dp

type SliderStyle

type SliderStyle struct {
	Axis  layout.Axis
	Color color.NRGBA
	Float *widget.Float

	FingerSize unit.Dp
}

func Slider

func Slider(th *Theme, float *widget.Float) SliderStyle

func (SliderStyle) Layout

func (s SliderStyle) Layout(gtx layout.Context) layout.Dimensions

type SwitchStyle

type SwitchStyle struct {
	Description string
	Color       struct {
		Enabled  color.NRGBA
		Disabled color.NRGBA
		Track    color.NRGBA
	}
	Switch *widget.Bool
}

func Switch

func Switch(th *Theme, swtch *widget.Bool, description string) SwitchStyle

func (SwitchStyle) Layout

func (s SwitchStyle) Layout(gtx layout.Context) layout.Dimensions

type Theme

type Theme struct {
	Shaper *text.Shaper
	Palette
	TextSize unit.Sp
	Icon     struct {
		CheckBoxChecked   *widget.Icon
		CheckBoxUnchecked *widget.Icon
		RadioChecked      *widget.Icon
		RadioUnchecked    *widget.Icon
	}

	Face font.Typeface

	FingerSize unit.Dp
}

func NewTheme

func NewTheme() *Theme

func (Theme) WithPalette

func (t Theme) WithPalette(p Palette) Theme

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL