Documentation ¶
Index ¶
- Constants
- func ClickBox(gtx layout.Context, button *widget.Clickable, w layout.Widget) layout.Dimensions
- func WithAlpha(c color.RGBA, alpha uint8) color.RGBA
- type AuthorNameStyle
- type Axis
- type C
- type Colors
- type CommunityNameStyle
- type D
- type IconButton
- type Rect
- type ReplyAnimationState
- type ReplyStatus
- type ReplyStyle
- type ScrollBar
- type Scrollable
- type TextFormStyle
- type Theme
Constants ¶
const ( Vertical = false Horizontal = true )
const DefaultIconButtonWidthDp = 20
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AuthorNameStyle ¶ added in v0.0.6
func AuthorName ¶ added in v0.0.6
func AuthorName(theme *material.Theme, identity *forest.Identity) AuthorNameStyle
func (AuthorNameStyle) Layout ¶ added in v0.0.6
func (a AuthorNameStyle) Layout(gtx layout.Context) layout.Dimensions
type Axis ¶ added in v0.0.10
type Axis bool
Axis specifies the scroll bar orientation. Default to `Vertical`.
type CommunityNameStyle ¶ added in v0.0.6
func CommunityName ¶ added in v0.0.6
func CommunityName(theme *material.Theme, community *forest.Community) CommunityNameStyle
func (CommunityNameStyle) Layout ¶ added in v0.0.6
func (a CommunityNameStyle) Layout(gtx layout.Context) layout.Dimensions
type D ¶ added in v0.0.6
type D = layout.Dimensions
type IconButton ¶ added in v0.0.10
type IconButton struct { Theme *Theme Button *widget.Clickable Icon *widget.Icon Size unit.Value Inset layout.Inset }
IconButton applies defaults before rendering a `material.IconButtonStyle` to reduce noise. The main paramaters for each button are the state and icon. Color, size and inset are often the same. This wrapper reduces noise by defaulting those things.
func (IconButton) Layout ¶ added in v0.0.10
func (btn IconButton) Layout(gtx C) D
type Rect ¶ added in v0.0.10
Rect creates a rectangle of the provided background color with Dimensions specified by size and a corner radius (on all corners) specified by radii.
type ReplyAnimationState ¶ added in v0.0.10
type ReplyAnimationState struct { *anim.Normal Begin, End ReplyStatus }
ReplyAnimationState holds the state of an in-progress animation for a reply. The anim.Normal field defines how far through the animation the node is, and the Begin and End fields define the two states that the node is transitioning between.
func (*ReplyAnimationState) Style ¶ added in v0.0.10
func (r *ReplyAnimationState) Style(gtx C, reply *ReplyStyle)
Style applies the appropriate visual tweaks the the reply status for the current animation frame.
type ReplyStatus ¶ added in v0.0.8
type ReplyStatus int
const ( None ReplyStatus = iota Sibling Selected Ancestor Descendant ConversationRoot )
func (ReplyStatus) HighlightColor ¶ added in v0.0.10
func (r ReplyStatus) HighlightColor(th *Theme) color.RGBA
type ReplyStyle ¶
type ReplyStyle struct { *Theme Highlight color.RGBA Background color.RGBA TextColor color.RGBA // MaxLines limits the maximum number of lines of content text that should // be displayed. Values less than 1 indicate unlimited. MaxLines int // CollapseMetadata should be set to true if this reply can be rendered // without the author being displayed. CollapseMetadata bool *ReplyAnimationState ds.ReplyData // contains filtered or unexported fields }
func Reply ¶
func Reply(th *Theme, status *ReplyAnimationState, nodes ds.ReplyData) ReplyStyle
func (ReplyStyle) Layout ¶
func (r ReplyStyle) Layout(gtx layout.Context) layout.Dimensions
type ScrollBar ¶ added in v0.0.10
type ScrollBar struct { *Scrollable // Color of the scroll indicator. Color color.RGBA // Progress tells the scrollbar where to render the indicator as a fraction [0, 1]. Progress float32 // Axis along which the scrollbar is oriented. Axis Axis // Axis independent size. Thickness unit.Value Length unit.Value }
ScrollBar renders a scroll bar anchored to a side.
type Scrollable ¶ added in v0.0.10
type Scrollable struct { // Track clicks. widget.Clickable // Track drag events. gesture.Drag // Progress is how far along we are as a fraction between 0 and 1. Progress float32 // contains filtered or unexported fields }
Scrollable holds the stateful part of a scrolling. The Progress property can be used to check how far the bar has been scrolled, and the Scrolled() method can be used to determine if the scroll position changed within the last frame.
func (Scrollable) Scrolled ¶ added in v0.0.10
func (sb Scrollable) Scrolled() bool
Scrolled returns true if the scroll position changed within the last frame.
func (*Scrollable) Update ¶ added in v0.0.10
func (sb *Scrollable) Update(gtx C, axis Axis)
Update the internal state of the scrollbar.
type TextFormStyle ¶ added in v0.0.9
type TextFormStyle struct { State *widget.TextForm // internal widget separation distance layout.Inset PasteButton material.IconButtonStyle SubmitButton material.ButtonStyle material.EditorStyle EditorBackground color.RGBA }
func TextForm ¶ added in v0.0.9
func TextForm(th *Theme, state *widget.TextForm, submitText, formHint string) TextFormStyle
func (TextFormStyle) Layout ¶ added in v0.0.9
func (t TextFormStyle) Layout(gtx layout.Context) layout.Dimensions