components

package
v0.0.0-...-a44c12d Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Button

type Button struct {
	Text      string
	Style     ButtonStyle
	Clickable *widget.Clickable
	Label     *widget.Label
	Focused   bool
	Disabled  bool
	Loading   bool
	Flex      bool
	// contains filtered or unexported fields
}

func NewButton

func NewButton(style ButtonStyle) *Button

func (*Button) Clicked

func (btn *Button) Clicked(gtx layout.Context) bool

func (*Button) Layout

func (btn *Button) Layout(gtx layout.Context, th *material.Theme) layout.Dimensions

func (*Button) SetLoading

func (btn *Button) SetLoading(loading bool)

type ButtonAnimation

type ButtonAnimation struct {
	// contains filtered or unexported fields
}

func NewButtonAnimationDefault

func NewButtonAnimationDefault() ButtonAnimation

func NewButtonAnimationScale

func NewButtonAnimationScale(v float32) ButtonAnimation

type ButtonColors

type ButtonColors struct {
	TextColor            color.NRGBA
	BackgroundColor      color.NRGBA
	HoverBackgroundColor *color.NRGBA
	HoverTextColor       *color.NRGBA
	BorderColor          color.NRGBA
}

type ButtonStyle

type ButtonStyle struct {
	Rounded     Rounded
	TextSize    unit.Sp
	Inset       layout.Inset
	Font        font.Font
	Icon        *widget.Icon
	IconGap     unit.Dp
	Animation   ButtonAnimation
	Border      widget.Border
	LoadingIcon *widget.Icon
	Colors      ButtonColors
}

type DragItems

type DragItems struct {
	// contains filtered or unexported fields
}

func NewDragItems

func NewDragItems() *DragItems

func (*DragItems) ItemMoved

func (l *DragItems) ItemMoved() (bool, int, int)

func (*DragItems) Layout

func (l *DragItems) Layout(gtx layout.Context, scroll *layout.Position, w layout.Widget) layout.Dimensions

func (*DragItems) LayoutItem

func (l *DragItems) LayoutItem(gtx layout.Context, index int, w layout.Widget)

type Fit

type Fit uint8

Fit scales a widget to fit and clip to the constraints.

const (
	// Unscaled does not alter the scale of a widget.
	Unscaled Fit = iota
	// Contain scales widget as large as possible without cropping
	// and it preserves aspect-ratio.
	Contain
	// Cover scales the widget to cover the constraint area and
	// preserves aspect-ratio.
	Cover
	// ScaleDown scales the widget smaller without cropping,
	// when it exceeds the constraint area.
	// It preserves aspect-ratio.
	ScaleDown
	// Fill stretches the widget to the constraints and does not
	// preserve aspect-ratio.
	Fill
)

type HoldPress

type HoldPress struct {
	TriggerDuration time.Duration
	Triggered       bool
	// contains filtered or unexported fields
}

func NewHoldPress

func NewHoldPress(duration time.Duration) *HoldPress

func (*HoldPress) Layout

type Image

type Image struct {
	// Src is the image to display.
	Src paint.ImageOp
	// Fit specifies how to scale the image to the constraints.
	// By default it does not do any scaling.
	Fit Fit
	// Position specifies where to position the image within
	// the constraints.
	Position layout.Direction
	// Scale is the factor used for converting image pixels to dp.
	// If Scale is zero it defaults to 1.
	//
	// To map one image pixel to one output pixel, set Scale to 1.0 / gtx.Metric.PxPerDp.
	Scale float32

	Rounded Rounded
}

Image is a widget that displays an image.

func (Image) Layout

func (im Image) Layout(gtx layout.Context, transform Transform) layout.Dimensions

type Input

type Input struct {
	FontWeight font.Weight
	TextSize   unit.Sp
	Editor     *widget.Editor
	EditorMinY int
	Border     widget.Border
	Inset      layout.Inset
	Clickable  *widget.Clickable
	Colors     InputColors
	// contains filtered or unexported fields
}

func NewInput

func NewInput() *Input

func NewNumberInput

func NewNumberInput() *Input

func NewPasswordInput

func NewPasswordInput() *Input

func (*Input) Layout

func (t *Input) Layout(gtx layout.Context, th *material.Theme, hint string) layout.Dimensions

func (*Input) SetValue

func (t *Input) SetValue(text string)

func (*Input) Submitted

func (t *Input) Submitted() (bool, string)

submit is lock by a mutex to avoid multiple calls because it work with press and not release key.release is not implemented for mobile app you have to call UnlockSubmit after a submit

func (*Input) UnlockSubmit

func (t *Input) UnlockSubmit()

func (*Input) Value

func (t *Input) Value() string

type InputColors

type InputColors struct {
	BorderColor       color.NRGBA
	BackgroundColor   color.NRGBA
	TextColor         color.NRGBA
	HintColor         color.NRGBA
	ReadOnlyTextColor color.NRGBA
}
type Modal struct {
	Style       ModalStyle
	Visible     bool
	CloseKeySet key.Set
	// contains filtered or unexported fields
}

func NewModal

func NewModal(style ModalStyle) *Modal

func (*Modal) Closed

func (modal *Modal) Closed() bool

func (*Modal) Layout

func (modal *Modal) Layout(gtx layout.Context, beforeLayout func(gtx layout.Context), w layout.Widget) layout.Dimensions

func (*Modal) SetVisible

func (modal *Modal) SetVisible(visible bool)

type ModalAnimation

type ModalAnimation struct {
	// contains filtered or unexported fields
}

func NewModalAnimationDown

func NewModalAnimationDown() ModalAnimation

func NewModalAnimationScaleBounce

func NewModalAnimationScaleBounce() ModalAnimation

func NewModalAnimationUp

func NewModalAnimationUp() ModalAnimation

type ModalColors

type ModalColors struct {
	BackgroundColor color.NRGBA
	BackdropColor   *color.NRGBA
}

type ModalStyle

type ModalStyle struct {
	CloseOnOutsideClick bool
	KeepClickableArea   bool
	CloseOnInsideClick  bool
	Direction           layout.Direction
	Inset               layout.Inset
	Rounded             Rounded
	Animation           ModalAnimation
	Colors              ModalColors
}

type NotificationColors

type NotificationColors struct {
	TextColor       color.NRGBA
	BackgroundColor color.NRGBA
}

type NotificationModal

type NotificationModal struct {
	Style NotificationStyle
	Modal *Modal
	// contains filtered or unexported fields
}

func NewNotificationModal

func NewNotificationModal(window *app.Window, style NotificationStyle) *NotificationModal

func (*NotificationModal) Layout

func (*NotificationModal) SetText

func (n *NotificationModal) SetText(title string, text string)

func (*NotificationModal) SetVisible

func (n *NotificationModal) SetVisible(visible bool, closeAfter time.Duration)

type NotificationStyle

type NotificationStyle struct {
	Icon       *widget.Icon
	Direction  layout.Direction
	OuterInset layout.Inset
	InnerInset layout.Inset
	Rounded    Rounded
	Animation  ModalAnimation
	Colors     NotificationColors
}

type ProgressBar

type ProgressBar struct {
	Value   float32
	Rounded unit.Dp
	Height  unit.Dp
	Colors  ProgressBarColors
}

func (ProgressBar) Layout

func (p ProgressBar) Layout(gtx layout.Context) layout.Dimensions

type ProgressBarColors

type ProgressBarColors struct {
	IndicatorColor  color.NRGBA
	BackgroundColor color.NRGBA
}

type Rounded

type Rounded struct {
	NW unit.Dp
	NE unit.Dp
	SW unit.Dp
	SE unit.Dp
}

func UniformRounded

func UniformRounded(r unit.Dp) Rounded

type TabBars

type TabBars struct {
	Key    string
	Items  []*TabBarsItem
	Colors TabBarsColors
	// contains filtered or unexported fields
}

func NewTabBars

func NewTabBars(defaultKey string, items []*TabBarsItem) *TabBars

func (*TabBars) Changed

func (t *TabBars) Changed() (bool, string)

func (*TabBars) Layout

func (t *TabBars) Layout(gtx layout.Context, th *material.Theme, textSize unit.Sp, text map[string]string) layout.Dimensions

type TabBarsColors

type TabBarsColors struct {
	ActiveColor   color.NRGBA
	InactiveColor color.NRGBA
}

type TabBarsItem

type TabBarsItem struct {
	Key string
	// contains filtered or unexported fields
}

func NewTabBarItem

func NewTabBarItem(key string) *TabBarsItem

func (*TabBarsItem) Layout

func (t *TabBarsItem) Layout(gtx layout.Context, th *material.Theme, tabBars *TabBars, textSize unit.Sp, text string) layout.Dimensions

type Transform

type Transform func(dims layout.Dimensions, trans f32.Affine2D) f32.Affine2D

Jump to

Keyboard shortcuts

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