Documentation
¶
Index ¶
- type C
- type D
- type Editable
- type LabelAlignment
- type LabelOption
- type Link
- type LinkSrc
- type LinkStyle
- type ModalLayer
- type Tag
- type TagVariant
- type TextField
- func (in *TextField) Changed() bool
- func (in *TextField) Clear()
- func (in *TextField) ClearError()
- func (in *TextField) Focused(gtx layout.Context) bool
- func (in *TextField) Layout(gtx layout.Context, th *theme.Theme, hint string) layout.Dimensions
- func (in *TextField) SetError(err string)
- func (in *TextField) SetFocus(gtx layout.Context)
- func (in *TextField) SetText(text string)
- func (in *TextField) State() *widget.Editor
- func (in *TextField) Submitted() bool
- func (in *TextField) Text() string
- type TransferTarget
- type Transferable
- type WrapList
- type WrapListStyle
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type D ¶
type D = layout.Dimensions
type Editable ¶ added in v0.6.0
type Editable struct {
Text string
TextSize unit.Sp
Color color.NRGBA
OnChanged func(text string)
// contains filtered or unexported fields
}
Editable is an editable label that layouts an editor in responds to clicking.
func EditableLabel ¶ added in v0.6.0
func (*Editable) SetEditing ¶ added in v0.6.0
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 Link ¶ added in v0.6.0
type Link[T LinkSrc] struct { Title string Src T Params map[string]interface{} // Open in new tab. Valid only if the link is a native gioview View. OpenInNewTab bool // Click handler for the link. OnClicked func(intent any) error // contains filtered or unexported fields }
A link is a clickable widget used to jump between views, or open a web URL, as anchor in HTML.
type LinkSrc ¶ added in v0.6.0
LinkSrc defines a generic type constraint. String type is for web url. And ViewID indicates a Gioview View.
type LinkStyle ¶ added in v0.6.0
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
// contains filtered or unexported fields
}
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) Disappear ¶ added in v0.8.1
func (m *ModalLayer) Disappear(now time.Time)
func (*ModalLayer) Dismissed ¶ added in v0.8.1
func (m *ModalLayer) Dismissed() bool
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.
func (*ModalLayer) ToggleVisibility ¶ added in v0.8.1
func (m *ModalLayer) ToggleVisibility(now time.Time)
func (*ModalLayer) Update ¶ added in v0.8.1
func (m *ModalLayer) Update(gtx C)
type Tag ¶ added in v0.6.0
type Tag struct {
Text string
TextSize unit.Sp
Font font.Font
// Text color the of label. For outine variant, this is also the border of the tag.
TextColor color.NRGBA
// Background color of the label. Only valid in the case of Solid variant.
Background color.NRGBA
Radius unit.Dp
Inset layout.Inset
Variant TagVariant
}
Tag is used for items that need to be labeled using keywords that describe them.
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 ¶
Changed returns whether or not the text input has changed since last call.
func (*TextField) ClearError ¶
func (in *TextField) ClearError()
type TransferTarget ¶ added in v0.6.0
type Transferable ¶ added in v0.6.0
type Transferable struct {
Target TransferTarget
// contains filtered or unexported fields
}
func (*Transferable) Update ¶ added in v0.6.0
func (t *Transferable) Update(gtx C) error
type WrapList ¶
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 (WrapListStyle) Layout ¶
func (l WrapListStyle) Layout(gtx layout.Context, length int, w layout.ListElement) layout.Dimensions
Layout the list and its scrollbar.