Documentation ¶
Index ¶
- Constants
- Variables
- func Disabled(c color.NRGBA) (d color.NRGBA)
- func DisplayOneDropdown(dropdowns ...*DropDown)
- func Fill(gtx layout.Context, col color.NRGBA) layout.Dimensions
- func GenerateRandomNumber() int
- func HandleEditorEvents(editors ...*widget.Editor) (bool, bool)
- func Hovered(c color.NRGBA) (d color.NRGBA)
- func MustIcon(ic *widget.Icon, err error) *widget.Icon
- func SwitchEditors(keyEvent chan *key.Event, editors ...*widget.Editor)
- type Badge
- type Border
- type Button
- type ButtonLayout
- type C
- type Card
- type CheckBoxStyle
- type Clickable
- func (cl *Clickable) ChangeStyle(style *values.ClickableStyle)
- func (cl *Clickable) Clicked() bool
- func (cl *Clickable) Enabled() bool
- func (cl *Clickable) IsHovered() bool
- func (cl *Clickable) Layout(gtx C, w layout.Widget) D
- func (cl *Clickable) SetEnabled(enable bool, gtx *layout.Context) layout.Context
- func (cl *Clickable) Style() values.ClickableStyle
- type ClickableList
- type Collapsible
- type CollapsibleWithOption
- type CornerRadius
- type D
- type DropDown
- type DropDownItem
- type Editor
- type Grid
- type GridElement
- type GridLayout
- type GridWrap
- type Hoverable
- type Icon
- type IconButton
- type IconButtonStyle
- type Icons
- type Image
- type Label
- type Line
- type LinearLayout
- type ListStyle
- type Modal
- type MultiLayerProgressBar
- type Outline
- type Password
- type Position
- type ProgressBarItem
- type ProgressBarStyle
- type RadioButton
- type RestoreEditor
- type ScrollbarStyle
- type Shadow
- type Switch
- type SwitchButtonText
- type SwitchItem
- type TabItem
- type Tabs
- type TextAndIconButton
- type Theme
- func (t *Theme) Background(gtx layout.Context, w layout.Widget)
- func (t *Theme) Badge() *Badge
- func (t *Theme) Body1(txt string) Label
- func (t *Theme) Body2(txt string) Label
- func (t *Theme) Button(txt string) Button
- func (t *Theme) ButtonLayout() ButtonLayout
- func (t *Theme) Caption(txt string) Label
- func (t *Theme) Card() Card
- func (t *Theme) CheckBox(checkBox *widget.Bool, label string) CheckBoxStyle
- func (t *Theme) Collapsible() *Collapsible
- func (t *Theme) CollapsibleWithOption() *CollapsibleWithOption
- func (t *Theme) DangerButton(text string) Button
- func (t *Theme) DropDown(items []DropDownItem, group uint, pos uint) *DropDown
- func (t *Theme) Editor(editor *widget.Editor, hint string) Editor
- func (t *Theme) EditorPassword(editor *widget.Editor, hint string) Editor
- func (t *Theme) ErrorLabel(txt string) Label
- func (t *Theme) H1(txt string) Label
- func (t *Theme) H2(txt string) Label
- func (t *Theme) H3(txt string) Label
- func (t *Theme) H4(txt string) Label
- func (t *Theme) H5(txt string) Label
- func (t *Theme) H6(txt string) Label
- func (t *Theme) Hoverable() *Hoverable
- func (t *Theme) IconButton(icon *widget.Icon) IconButton
- func (t *Theme) IconButtonWithStyle(ibs IconButtonStyle, colorStyle *values.ColorStyle) IconButton
- func (t *Theme) IconEditor(editor *widget.Editor, hint string, icon *widget.Icon, clickableIcon bool) Editor
- func (t *Theme) ImageIcon(gtx layout.Context, icon image.Image, size int) layout.Dimensions
- func (t *Theme) Label(size unit.Value, txt string) Label
- func (t *Theme) Line(height, width int) Line
- func (t *Theme) List(state *widget.List) ListStyle
- func (t *Theme) Modal() *Modal
- func (t *Theme) ModalFloatTitle() *Modal
- func (t *Theme) MultiLayerProgressBar(total float32, items []ProgressBarItem) *MultiLayerProgressBar
- func (t *Theme) NewClickable(hoverable bool) *Clickable
- func (t *Theme) NewClickableList(axis layout.Axis) *ClickableList
- func (t *Theme) Outline() Outline
- func (t *Theme) OutlineButton(txt string) Button
- func (t *Theme) Password() *Password
- func (t *Theme) ProgressBar(progress int) ProgressBarStyle
- func (t *Theme) RadioButton(group *widget.Enum, key, label string, color, icon color.NRGBA) RadioButton
- func (t *Theme) RestoreEditor(editor *widget.Editor, hint string, title string) RestoreEditor
- func (t *Theme) Scrollbar(state *widget.Scrollbar) ScrollbarStyle
- func (t *Theme) Separator() Line
- func (t *Theme) SeparatorVertical(height, width int) Line
- func (t *Theme) Shadow() *Shadow
- func (t *Theme) Surface(gtx layout.Context, w layout.Widget) layout.Dimensions
- func (t *Theme) Switch() *Switch
- func (t *Theme) SwitchButtonText(i []SwitchItem) *SwitchButtonText
- func (t *Theme) SwitchDarkMode(isDarkModeOn bool, decredIcons map[string]image.Image)
- func (t *Theme) TextAndIconButton(text string, icon *widget.Icon) TextAndIconButton
- func (t *Theme) Tooltip() *Tooltip
- type Tooltip
Constants ¶
const ( WrapContent = -1 MatchParent = -2 )
const (
DropdownBasePos uint = 0
)
Variables ¶
var MaxWidth = unit.Dp(800)
Functions ¶
func Disabled ¶
Disabled blends color towards the luminance and multiplies alpha. Blending towards luminance will desaturate the color. Multiplying alpha blends the color together more with the background.
func DisplayOneDropdown ¶ added in v1.7.0
func DisplayOneDropdown(dropdowns ...*DropDown)
Display one dropdown at a time
func GenerateRandomNumber ¶ added in v1.7.0
func GenerateRandomNumber() int
func HandleEditorEvents ¶ added in v1.7.0
Types ¶
type Border ¶
type Border struct { Color color.NRGBA Radius CornerRadius Width unit.Value }
Border lays out a widget and draws a border inside it.
type Button ¶
type Button struct { material.ButtonStyle HighlightColor color.NRGBA Margin layout.Inset // contains filtered or unexported fields }
func (*Button) SetClickable ¶ added in v1.7.0
func (*Button) SetEnabled ¶
type ButtonLayout ¶
type ButtonLayout struct {
material.ButtonLayoutStyle
}
func (ButtonLayout) Layout ¶
func (bl ButtonLayout) Layout(gtx layout.Context, w layout.Widget) layout.Dimensions
type Card ¶
func (Card) HoverableLayout ¶ added in v1.7.0
type CheckBoxStyle ¶
type CheckBoxStyle struct {
material.CheckBoxStyle
}
func (CheckBoxStyle) Layout ¶
func (c CheckBoxStyle) Layout(gtx layout.Context) layout.Dimensions
Layout updates the checkBox and displays it.
type Clickable ¶
type Clickable struct { Hoverable bool Radius CornerRadius // contains filtered or unexported fields }
func (*Clickable) ChangeStyle ¶ added in v1.7.0
func (cl *Clickable) ChangeStyle(style *values.ClickableStyle)
func (*Clickable) SetEnabled ¶ added in v1.7.0
SetEnabled enables/disables the clickable.
func (*Clickable) Style ¶ added in v1.7.0
func (cl *Clickable) Style() values.ClickableStyle
type ClickableList ¶
type ClickableList struct { layout.List Radius CornerRadius // this radius is used by the clickable DividerHeight unit.Value IsShadowEnabled bool IsHoverable bool // contains filtered or unexported fields }
func (*ClickableList) ItemClicked ¶
func (cl *ClickableList) ItemClicked() (bool, int)
func (*ClickableList) Layout ¶
func (cl *ClickableList) Layout(gtx layout.Context, count int, w layout.ListElement) layout.Dimensions
type Collapsible ¶
func (*Collapsible) IsExpanded ¶ added in v1.7.0
func (c *Collapsible) IsExpanded() bool
func (*Collapsible) Layout ¶
func (c *Collapsible) Layout(gtx layout.Context, header, body func(C) D) layout.Dimensions
type CollapsibleWithOption ¶
type CollapsibleWithOption struct { BackgroundColor color.NRGBA // contains filtered or unexported fields }
func (*CollapsibleWithOption) Layout ¶
func (c *CollapsibleWithOption) Layout(gtx layout.Context, header, body func(C) D, more func(C), rowID int) layout.Dimensions
func (*CollapsibleWithOption) MoreTriggered ¶
func (c *CollapsibleWithOption) MoreTriggered() bool
type CornerRadius ¶
type CornerRadius struct { TopLeft float32 TopRight float32 BottomRight float32 BottomLeft float32 }
func BottomRadius ¶
func BottomRadius(radius float32) CornerRadius
func Radius ¶
func Radius(radius float32) CornerRadius
func TopRadius ¶
func TopRadius(radius float32) CornerRadius
type D ¶
type D = layout.Dimensions
type DropDown ¶
func ResliceDropdown ¶ added in v1.7.0
Reslice the dropdowns
func (*DropDown) SelectedIndex ¶
type DropDownItem ¶
type Editor ¶
type Editor struct { material.EditorStyle TitleLabel Label LineColor color.NRGBA // IsRequired if true, displays a required field text at the buttom of the editor. IsRequired bool // IsTitleLabel if true makes the title label visible. IsTitleLabel bool HasCustomButton bool CustomButton Button // Bordered if true makes the adds a border around the editor. Bordered bool EditorIconButtonEvent func() // contains filtered or unexported fields }
func (*Editor) ClearError ¶
func (e *Editor) ClearError()
func (*Editor) SetRequiredErrorText ¶
type Grid ¶
type Grid struct { Num int Axis layout.Axis Alignment layout.Alignment // contains filtered or unexported fields }
Grid lays out at most Num elements along the main axis. The number of cross axis elements depend on the total number of elements.
func (*Grid) Layout ¶
func (g *Grid) Layout(gtx layout.Context, num int, el GridElement) layout.Dimensions
type GridElement ¶
type GridElement func(gtx layout.Context, i int) layout.Dimensions
GridElement lays out the ith element of a Grid.
type GridLayout ¶
type GridLayout struct { List *layout.List HorizontalSpacing layout.Spacing Alignment layout.Alignment Direction layout.Direction RowCount int }
func (GridLayout) Layout ¶
func (g GridLayout) Layout(gtx layout.Context, num int, el GridElement) layout.Dimensions
type GridWrap ¶
GridWrap lays out as many elements as possible along the main axis before wrapping to the cross axis.
func (GridWrap) Layout ¶
func (g GridWrap) Layout(gtx layout.Context, num int, el GridElement) layout.Dimensions
type IconButton ¶
type IconButton struct { IconButtonStyle // contains filtered or unexported fields }
func (IconButton) ChangeColorStyle ¶ added in v1.7.0
func (ib IconButton) ChangeColorStyle(colorStyle *values.ColorStyle)
TODO: Test to ensure this works! TODO: Doesn't work, if ib.colorStyle was nil before this method is called, it is temporarily changed but when ib.Layout is called, it returns to nil.
func (IconButton) Layout ¶
func (ib IconButton) Layout(gtx layout.Context) layout.Dimensions
type IconButtonStyle ¶ added in v1.7.0
type IconButtonStyle struct { Icon *widget.Icon Size unit.Value Inset layout.Inset Button *widget.Clickable }
IconButtonStyle is similar to material.IconButtonStyle but excluding the color fields. This ensures that the IconButton colors are only set using the IconButton.colorStyle field.
type Icons ¶ added in v1.7.0
type Icons struct {
func (*Icons) DarkModeIcons ¶ added in v1.7.0
func (*Icons) DefaultIcons ¶ added in v1.7.0
func (*Icons) StandardMaterialIcons ¶ added in v1.7.0
type Image ¶
func (*Image) Layout12dp ¶
func (*Image) Layout16dp ¶
func (*Image) Layout24dp ¶
func (*Image) Layout36dp ¶
func (*Image) Layout48dp ¶
type Label ¶
type Label struct {
material.LabelStyle
}
type Line ¶
type Line struct { Height int Width int Color color.NRGBA // contains filtered or unexported fields }
Line represents a rectangle widget with an initial thickness of 1
type LinearLayout ¶
type ListStyle ¶ added in v1.7.0
ListStyle configures the presentation of a layout.List with a scrollbar.
func (ListStyle) Layout ¶ added in v1.7.0
func (l ListStyle) Layout(gtx layout.Context, length int, w layout.ListElement) layout.Dimensions
Layout the list and its scrollbar.
type Modal ¶
type Modal struct {
// contains filtered or unexported fields
}
func (*Modal) BackdropClicked ¶
func (*Modal) Layout ¶
Layout renders the modal widget to screen. The modal assumes the size of its content plus padding.
func (*Modal) SetDisabled ¶ added in v1.7.0
func (*Modal) SetPadding ¶ added in v1.7.0
func (*Modal) ShowScrollbar ¶ added in v1.7.0
type MultiLayerProgressBar ¶ added in v1.7.0
type MultiLayerProgressBar struct { Radius CornerRadius Height unit.Value Width float32 // contains filtered or unexported fields }
MultiLayerProgressBar shows the percentage of the mutiple progress layer against the total/expected progress.
type Password ¶
type Password struct {
// contains filtered or unexported fields
}
func (*Password) Layout ¶
func (p *Password) Layout(gtx layout.Context, confirm func([]byte), cancel func()) layout.Dimensions
Layout renders the widget to screen. The confirm function passed by the calling page is called when the confirm button is clicked, and the form passes validation. The entered password is passed as an argument to the confirm func. The cancel func is called when the cancel button is clicked
type Position ¶
type Position int
Position determines what side of the page the tab would be laid out
type ProgressBarItem ¶ added in v1.7.0
type ProgressBarStyle ¶
type ProgressBarStyle struct { Radius CornerRadius Height unit.Value Width unit.Value Direction layout.Direction material.ProgressBarStyle }
func (ProgressBarStyle) Layout ¶
func (p ProgressBarStyle) Layout(gtx layout.Context) layout.Dimensions
func (ProgressBarStyle) Layout2 ¶
func (p ProgressBarStyle) Layout2(gtx C) D
This achieves a progress bar using linear layouts.
type RadioButton ¶
type RadioButton struct {
material.RadioButtonStyle
}
type RestoreEditor ¶
type RestoreEditor struct { Edit Editor TitleLabel Label LineColor color.NRGBA // contains filtered or unexported fields }
func (RestoreEditor) Layout ¶
func (re RestoreEditor) Layout(gtx layout.Context) layout.Dimensions
type ScrollbarStyle ¶ added in v1.7.0
type ScrollbarStyle struct {
material.ScrollbarStyle
}
ScrollbarStyle configures the presentation of a scrollbar.
type Shadow ¶
type Shadow struct {
// contains filtered or unexported fields
}
func (*Shadow) SetShadowElevation ¶ added in v1.7.0
func (*Shadow) SetShadowRadius ¶ added in v1.7.0
type Switch ¶
type Switch struct {
// contains filtered or unexported fields
}
func (*Switch) SetChecked ¶
func (*Switch) SetEnabled ¶ added in v1.7.0
type SwitchButtonText ¶
type SwitchButtonText struct {
ActiveTextColor, InactiveTextColor color.NRGBA
Active, Inactive color.NRGBA
// contains filtered or unexported fields
}
func (*SwitchButtonText) Changed ¶ added in v1.7.0
func (s *SwitchButtonText) Changed() bool
func (*SwitchButtonText) Layout ¶
func (s *SwitchButtonText) Layout(gtx layout.Context) layout.Dimensions
func (*SwitchButtonText) SelectedIndex ¶
func (s *SwitchButtonText) SelectedIndex() int
func (*SwitchButtonText) SelectedOption ¶
func (s *SwitchButtonText) SelectedOption() string
type SwitchItem ¶
type SwitchItem struct { Text string // contains filtered or unexported fields }
type Tabs ¶
type Tabs struct { Size float32 Selected int Position Position Separator bool // contains filtered or unexported fields }
Tabs displays succession of TabItems. Using the Position option, Tabs can be displayed on any four sides of a rendered page.
func (*Tabs) ChangeEvent ¶
ChangeEvent returns the last change event
type TextAndIconButton ¶
type TextAndIconButton struct { Button *widget.Clickable Color color.NRGBA BackgroundColor color.NRGBA // contains filtered or unexported fields }
func (TextAndIconButton) Layout ¶
func (b TextAndIconButton) Layout(gtx layout.Context) layout.Dimensions
type Theme ¶
type Theme struct { Shaper text.Shaper Base *material.Theme Color *values.Color Styles *values.WidgetStyles Icons *Icons TextSize unit.Value // contains filtered or unexported fields }
func (*Theme) ButtonLayout ¶
func (t *Theme) ButtonLayout() ButtonLayout
func (*Theme) CheckBox ¶
func (t *Theme) CheckBox(checkBox *widget.Bool, label string) CheckBoxStyle
func (*Theme) Collapsible ¶
func (t *Theme) Collapsible() *Collapsible
func (*Theme) CollapsibleWithOption ¶
func (t *Theme) CollapsibleWithOption() *CollapsibleWithOption
func (*Theme) DangerButton ¶
DangerButton a button with the background set to theme.Danger
func (*Theme) DropDown ¶
func (t *Theme) DropDown(items []DropDownItem, group uint, pos uint) *DropDown
DropDown returns a dropdown component. {pos} parameter signifies the position of the dropdown in a dropdown group on the UI, the first dropdown should be assigned pos 0, next 1..etc. incorrectly assigned Dropdown pos will result in inconsistent dropdown backdrop.
func (*Theme) EditorPassword ¶
func (*Theme) ErrorLabel ¶
func (*Theme) IconButton ¶
func (t *Theme) IconButton(icon *widget.Icon) IconButton
func (*Theme) IconButtonWithStyle ¶ added in v1.7.0
func (t *Theme) IconButtonWithStyle(ibs IconButtonStyle, colorStyle *values.ColorStyle) IconButton
func (*Theme) IconEditor ¶ added in v1.7.0
func (t *Theme) IconEditor(editor *widget.Editor, hint string, icon *widget.Icon, clickableIcon bool) Editor
IconEditor creates an editor widget with icon of choice
func (*Theme) ModalFloatTitle ¶
func (*Theme) MultiLayerProgressBar ¶ added in v1.7.0
func (t *Theme) MultiLayerProgressBar(total float32, items []ProgressBarItem) *MultiLayerProgressBar
func (*Theme) NewClickable ¶ added in v1.7.0
func (*Theme) NewClickableList ¶
func (t *Theme) NewClickableList(axis layout.Axis) *ClickableList
func (*Theme) OutlineButton ¶ added in v1.7.0
func (*Theme) ProgressBar ¶
func (t *Theme) ProgressBar(progress int) ProgressBarStyle
func (*Theme) RadioButton ¶
func (t *Theme) RadioButton(group *widget.Enum, key, label string, color, icon color.NRGBA) RadioButton
RadioButton returns a RadioButton with a label. The key specifies the value for the Enum.
func (*Theme) RestoreEditor ¶
func (*Theme) SeparatorVertical ¶
SeparatorVertical returns a vertical line widget instance
func (*Theme) SwitchButtonText ¶
func (t *Theme) SwitchButtonText(i []SwitchItem) *SwitchButtonText
func (*Theme) SwitchDarkMode ¶
func (*Theme) TextAndIconButton ¶
func (t *Theme) TextAndIconButton(text string, icon *widget.Icon) TextAndIconButton
Source Files ¶
- badge.go
- border.go
- button.go
- card.go
- checkbox.go
- clickable.go
- clickable_list.go
- collapsible.go
- dropdown.go
- editor.go
- grid.go
- gridlayout.go
- hoverable.go
- icon.go
- icon_gallery.go
- image.go
- label.go
- line.go
- linearlayout.go
- list_scroll.go
- modal.go
- outline.go
- password.go
- progressbar.go
- radiobutton.go
- shadow.go
- switch.go
- tabs.go
- theme.go
- tooltip.go
- util.go