Documentation ¶
Overview ¶
Package view provides the component library. See https://gomatcha.io/guide/view/ for more details.
Index ¶
- func Alert(title, message string, buttons ...*AlertButton)
- func CopyFields(dst, src View)
- func EntersStage(from, to, s Stage) bool
- func ExitsStage(from, to, s Stage) bool
- type AlertButton
- type BasicView
- type Button
- type Context
- type Embed
- func (e *Embed) Build(ctx Context) Model
- func (e *Embed) Lifecycle(from, to Stage)
- func (e *Embed) Notify(f func()) comm.Id
- func (e *Embed) Signal()
- func (e *Embed) Subscribe(n comm.Notifier)
- func (e *Embed) Unnotify(id comm.Id)
- func (e *Embed) Unsubscribe(n comm.Notifier)
- func (e *Embed) Update(v View)
- func (e *Embed) ViewKey() interface{}
- type Id
- type ImageButton
- type ImageResizeMode
- type ImageView
- type Model
- type Option
- type ScrollPosition
- type ScrollView
- type Slider
- type Stage
- type Switch
- type TextInput
- type TextView
- type View
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Alert ¶ added in v0.2.0
func Alert(title, message string, buttons ...*AlertButton)
Alert displays an alert with the given title, message and buttons. If no buttons are passed, a default OK button is created.
func CopyFields ¶ added in v0.2.0
func CopyFields(dst, src View)
Copy all public fields from src to dst, that aren't 'Embed'.
func EntersStage ¶
EntersStage returns true if from﹤s and to≥s.
func ExitsStage ¶
ExitsStage returns true if from≥s and to﹤s.
Types ¶
type AlertButton ¶ added in v0.2.0
type AlertButton struct { Title string OnPress func() }
AlertButton represents an alert button.
type Button ¶ added in v0.2.0
type Button struct { Embed String string Color color.Color OnPress func() Enabled bool PaintStyle *paint.Style }
Button implements a native button view.
type Embed ¶
type Embed struct { Key interface{} // contains filtered or unexported fields }
Embed is a convenience struct that provides a default implementation of View. It also wraps a comm.Relay.
func (*Embed) Unsubscribe ¶
Unsubscribe calls Unsubscribe(n) on the underlying comm.Relay.
type ImageButton ¶ added in v0.2.0
func NewImageButton ¶ added in v0.2.0
func NewImageButton() *ImageButton
func (*ImageButton) Build ¶ added in v0.2.0
func (v *ImageButton) Build(ctx Context) Model
type ImageResizeMode ¶ added in v0.2.0
type ImageResizeMode int
const ( // The image is resized proportionally such that a single axis is filled. ImageResizeModeFit ImageResizeMode = iota // The image is resized proportionally such that the entire view is filled. ImageResizeModeFill // The image is stretched to fill the view. ImageResizeModeStretch // The image is centered in the view with its natural size. ImageResizeModeCenter )
TODO(KD): ResizeModeFit and ResizeModeFill behave oddly on Android.
func (ImageResizeMode) MarshalProtobuf ¶ added in v0.2.0
func (m ImageResizeMode) MarshalProtobuf() pbview.ImageResizeMode
type ImageView ¶ added in v0.2.0
type ImageView struct { Embed Image image.Image ResizeMode ImageResizeMode ImageTint color.Color PaintStyle *paint.Style URL string // contains filtered or unexported fields }
ImageView implements a view that displays an image.
type Model ¶
type Model struct { Children []View Layouter layout.Layouter Painter paint.Painter Options []Option NativeViewName string NativeViewState []byte NativeOptions map[string][]byte NativeFuncs map[string]interface{} }
Model describes the view and its children.
type ScrollPosition ¶ added in v0.2.0
type ScrollPosition struct { X animate.Value Y animate.Value // contains filtered or unexported fields }
func (*ScrollPosition) Notify ¶ added in v0.2.0
func (p *ScrollPosition) Notify(f func()) comm.Id
func (*ScrollPosition) SetValue ¶ added in v0.2.0
func (p *ScrollPosition) SetValue(val layout.Point)
func (*ScrollPosition) Unnotify ¶ added in v0.2.0
func (p *ScrollPosition) Unnotify(id comm.Id)
func (*ScrollPosition) Value ¶ added in v0.2.0
func (p *ScrollPosition) Value() layout.Point
type ScrollView ¶ added in v0.2.0
type ScrollView struct { Embed ScrollAxes layout.Axis IndicatorAxes layout.Axis ScrollEnabled bool ScrollPosition *ScrollPosition OnScroll func(position layout.Point) ContentChildren []View ContentPainter paint.Painter ContentLayouter layout.Layouter PaintStyle *paint.Style // contains filtered or unexported fields }
func NewScrollView ¶ added in v0.2.0
func NewScrollView() *ScrollView
NewScrollView returns a new view.
func (*ScrollView) Build ¶ added in v0.2.0
func (v *ScrollView) Build(ctx Context) Model
Build implements view.View.
type Slider ¶ added in v0.2.0
type Slider struct { Embed PaintStyle *paint.Style Value float64 ValueNotifier comm.Float64Notifier MaxValue float64 MinValue float64 OnChange func(value float64) OnSubmit func(value float64) Enabled bool // contains filtered or unexported fields }
type Switch ¶ added in v0.2.0
type TextInput ¶ added in v0.2.0
type TextInput struct { Embed PaintStyle *paint.Style Text *text.Text Style *text.Style Placeholder string PlaceholderStyle *text.Style Password bool KeyboardType keyboard.Type Responder *keyboard.Responder MaxLines int // This is used only for sizing. OnChange func(*text.Text) OnSubmit func(*text.Text) OnFocus func(*keyboard.Responder) // contains filtered or unexported fields }
TextInput represents a text input view. TextInput mutates the Text and StyledText fields in place.
type TextView ¶ added in v0.2.0
type TextView struct { Embed PaintStyle *paint.Style String string Text *text.Text Style *text.Style StyledText *text.StyledText // TODO(KD): subscribe to StyledText and Text MaxLines int }
TextView displays a multiline text region within it bounds.