Documentation ¶
Overview ¶
Package component copy form github.com/gio-x
Index ¶
- func WithAlpha(c color.NRGBA, a uint8) color.NRGBA
- type AlphaPalette
- type C
- type D
- type Progress
- func (p Progress) Absolute() float32
- func (p Progress) Direction() ProgressDirection
- func (p Progress) Finished() bool
- func (p Progress) Progress() float32
- func (p *Progress) Start(began time.Time, direction ProgressDirection, duration time.Duration)
- func (p Progress) Started() bool
- func (p *Progress) Stop()
- func (p *Progress) Update(now time.Time)
- type ProgressDirection
- type Rect
- type TextField
- func (in *TextField) Clear()
- func (in *TextField) ClearError()
- func (in TextField) IsActive() bool
- func (in *TextField) IsErrored() bool
- func (in *TextField) Layout(gtx C, th *material.Theme, hint string) D
- func (in *TextField) SetError(err string)
- func (in *TextField) TextTooLong() bool
- func (in *TextField) Update(gtx C, th *material.Theme, hint string)
- type Validator
- type VisibilityAnimation
- func (v VisibilityAnimation) Animating() bool
- func (v *VisibilityAnimation) Appear(now time.Time)
- func (v *VisibilityAnimation) Disappear(now time.Time)
- func (v *VisibilityAnimation) Revealed(gtx layout.Context) float32
- func (v *VisibilityAnimation) String(gtx layout.Context) string
- func (v *VisibilityAnimation) ToggleVisibility(now time.Time)
- func (v VisibilityAnimation) Visible() bool
- type VisibilityAnimationState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AlphaPalette ¶
type AlphaPalette struct {
Hover, Selected uint8
}
AlphaPalette is the set of alpha values to be applied for certain material design states like hover, selected, etc...
type D ¶
type D = layout.Dimensions
type Progress ¶
type Progress struct {
// contains filtered or unexported fields
}
Progress is an animation primitive that tracks progress of time over a fixed duration as a float between [0, 1].
Progress is reversable.
Widgets map async UI events to state changes: stop, forward, reverse. Widgets then interpolate visual data based on progress value.
Update method must be called every tick to update the progress value.
func (Progress) Direction ¶
func (p Progress) Direction() ProgressDirection
Direction reports the current direction.
type ProgressDirection ¶
type ProgressDirection int
ProgressDirection specifies how to update progress every tick.
const ( // Forward progresses from 0 to 1. Forward ProgressDirection = iota // Reverse progresses from 1 to 0. Reverse )
func (ProgressDirection) String ¶
func (d ProgressDirection) String() string
type TextField ¶
type TextField struct { // Editor contains the edit buffer. widget.Editor // Helper text to give additional context to a field. Helper string // CharLimit specifies the maximum number of characters the text input // will allow. Zero means "no limit". CharLimit uint // Prefix appears before the content of the text input. Prefix layout.Widget // Suffix appears after the content of the text input. Suffix layout.Widget // contains filtered or unexported fields }
TextField implements the Material Design Text Field described here: https://material.io/components/text-fields
func (*TextField) Clear ¶
func (in *TextField) Clear()
Clear the input text and reset any error status.
func (*TextField) ClearError ¶
func (in *TextField) ClearError()
ClearError clears any errored status.
func (*TextField) IsErrored ¶
IsErrored if input is in an errored state. Typically this is when the validator has returned an error message.
func (*TextField) SetError ¶
SetError puts the input into an errored state with the specified error text.
func (*TextField) TextTooLong ¶
TextTooLong returns whether the current editor text exceeds the set character limit.
type Validator ¶
Validator validates text and returns a string describing the error. Error is displayed as helper text.
type VisibilityAnimation ¶
type VisibilityAnimation struct { // How long does the animation last time.Duration State VisibilityAnimationState Started time.Time }
VisibilityAnimation holds the animation state for animations that transition between a "visible" and "invisible" state for a fixed duration of time.
func (VisibilityAnimation) Animating ¶
func (v VisibilityAnimation) Animating() bool
Animating() returns whether the animation is either in the process of appearsing or disappearing.
func (*VisibilityAnimation) Appear ¶
func (v *VisibilityAnimation) Appear(now time.Time)
Appear triggers the animation to begin becoming visible at the provided time. It is a no-op if the animation is already visible.
func (*VisibilityAnimation) Disappear ¶
func (v *VisibilityAnimation) Disappear(now time.Time)
Disappear triggers the animation to begin becoming invisible at the provided time. It is a no-op if the animation is already invisible.
func (*VisibilityAnimation) Revealed ¶
func (v *VisibilityAnimation) Revealed(gtx layout.Context) float32
Revealed returns the fraction of the animated entity that should be revealed at the current time in the animation. This fraction is computed with linear interpolation.
Revealed should be invoked during every frame that v.Animating() returns true.
If the animation reaches its end this frame, Revealed will transition it to a non-animating state automatically.
If the animation is in the process of animating, calling Revealed will automatically add an InvalidateOp to the provided layout.Context to ensure that the next frame will be generated promptly.
func (*VisibilityAnimation) String ¶
func (v *VisibilityAnimation) String(gtx layout.Context) string
func (*VisibilityAnimation) ToggleVisibility ¶
func (v *VisibilityAnimation) ToggleVisibility(now time.Time)
ToggleVisibility will make an invisible animation begin the process of becoming visible and a visible animation begin the process of disappearing.
func (VisibilityAnimation) Visible ¶
func (v VisibilityAnimation) Visible() bool
Visible() returns whether any part of the animated entity should be visible during the current animation frame.
type VisibilityAnimationState ¶
type VisibilityAnimationState int
VisibilityAnimationState represents possible states that a VisibilityAnimation can be in.
const ( Visible VisibilityAnimationState = iota Disappearing Appearing Invisible )
func (VisibilityAnimationState) String ¶
func (v VisibilityAnimationState) String() string