widget

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type C

type C = layout.Context

type D

type D = layout.Dimensions

type LabelAlignment

type LabelAlignment uint8
const (
	Top LabelAlignment = iota
	Left
	Right
	Hidden
)

type LabelOption

type LabelOption struct {
	Alignment LabelAlignment
	Ratio     float32
	// Space between laben and input box
	Padding unit.Dp
}

type ModalLayer added in v0.5.0

type ModalLayer struct {
	component.VisibilityAnimation
	Widget func(gtx layout.Context, th *material.Theme, anim *component.VisibilityAnimation) layout.Dimensions
}

ModalLayer is a widget drawn on top of the normal UI that can be populated by other components with dismissble modal dialogs.

func NewModal added in v0.5.0

func NewModal() *ModalLayer

NewModal creates an initializes a modal layer.

func (*ModalLayer) Layout added in v0.5.0

func (m *ModalLayer) Layout(gtx layout.Context, th *material.Theme) layout.Dimensions

Layout renders the modal layer. Unless a modal widget has been triggered, this will do nothing.

type TextField

type TextField struct {
	// padding between the text and border.
	Padding unit.Dp
	// border radius of the input box.
	Radius     unit.Dp
	SingleLine bool
	// Text alignment in the box.
	Alignment text.Alignment
	// Label alignment option
	LabelOption LabelOption

	// Helper text to give additional context to a field.
	HelperText string
	// The maximum number of characters the text input will allow.
	// Zero means no limit.
	MaxChars int
	// Mask replaces the visual display of each rune in the contents with the given rune.
	Mask rune

	// Leading appears before the content of the text input.
	Leading layout.Widget
	// Trailing appears after the content of the text input.
	Trailing layout.Widget
	// contains filtered or unexported fields
}

Another TextField implementation with the following features: * configurable padding and border radius * more compact design by put character counters inline. * subscribe ESC key events to defocus the text field. * configurable label alignment.

func (*TextField) Changed

func (in *TextField) Changed() bool

Changed returns whether or not the text input has changed since last call.

func (*TextField) Clear

func (in *TextField) Clear()

Clear clears the input text.

func (*TextField) ClearError

func (in *TextField) ClearError()

func (*TextField) Focused

func (in *TextField) Focused(gtx layout.Context) bool

func (*TextField) Layout

func (in *TextField) Layout(gtx layout.Context, th *theme.Theme, hint string) layout.Dimensions

func (*TextField) SetError

func (in *TextField) SetError(err string)

func (*TextField) SetText

func (in *TextField) SetText(text string)

func (*TextField) Submitted

func (in *TextField) Submitted() bool

func (*TextField) Text

func (in *TextField) Text() string

Text returns the current input text.

type WrapList

type WrapList struct {
	widget.Scrollbar
	gvlayout.List
}

WrapList holds the persistent state for a wrappable layout.List that has a scrollbar attached.

type WrapListStyle

type WrapListStyle struct {
	material.ScrollbarStyle
	material.AnchorStrategy
	// contains filtered or unexported fields
}

WrapListStyle configures the presentation of a wrappable layout.List with a scrollbar.

func List

func List(th *theme.Theme, state *WrapList) *WrapListStyle

func (WrapListStyle) Layout

Layout the list and its scrollbar.

Jump to

Keyboard shortcuts

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