ui

package
v0.0.0-...-3f8ce9d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2022 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultInset = layout.UniformInset(unit.Dp(8))

Functions

func Loop

func Loop(w *app.Window) error

func PaintRect

func PaintRect(gtx Gtx, size image.Point, fill color.NRGBA)

Types

type Accordion

type Accordion struct {
	Animation component.VisibilityAnimation
	widget.Clickable
	Child layout.Widget
	*material.Theme

	Title           string
	TitleIcon       *widget.Icon
	ClickCallback   func()
	NoToggleOnClick bool
	material.ButtonLayoutStyle
	// contains filtered or unexported fields
}

func (*Accordion) Layout

func (a *Accordion) Layout(gtx Gtx) (d Dim)

type AppManager

type AppManager struct {
	*app.Window

	*NavDrawer
	*component.ModalLayer
	BottomBar bool
	*material.Theme
	Service service.Service

	Constraints layout.Constraints
	Metric      unit.Metric
	*explorer.Explorer
	// contains filtered or unexported fields
}

AppManager Always call NewAppManager function to create AppManager instance

func NewAppManager

func NewAppManager(w *app.Window) *AppManager

NewAppManager Always call this function to create AppManager instance

func (*AppManager) CurrentPage

func (a *AppManager) CurrentPage() Page

func (*AppManager) GetWindowWidthInDp

func (a *AppManager) GetWindowWidthInDp() int

func (*AppManager) GetWindowWidthInPx

func (a *AppManager) GetWindowWidthInPx() int

func (*AppManager) Layout

func (a *AppManager) Layout(gtx Gtx) Dim

func (*AppManager) PopUp

func (a *AppManager) PopUp()

func (*AppManager) PushPage

func (a *AppManager) PushPage(page Page)

type ChatNavItem

type ChatNavItem struct {
	*AppManager
	Name string
	Icon *widget.Icon

	widget.Clickable
	*material.Theme
	ThemeAlt *material.Theme
	Accordion
	// contains filtered or unexported fields
}

func NewChatNavItem

func NewChatNavItem(manager *AppManager, theme *material.Theme) *ChatNavItem

func (*ChatNavItem) AddChild

func (n *ChatNavItem) AddChild(item *ChatRoomNavItem)

func (*ChatNavItem) Children

func (n *ChatNavItem) Children() []NavItem

func (*ChatNavItem) ClickCallback

func (n *ChatNavItem) ClickCallback()

func (*ChatNavItem) IsSelected

func (n *ChatNavItem) IsSelected() bool

func (*ChatNavItem) Layout

func (n *ChatNavItem) Layout(gtx Gtx) Dim

func (*ChatNavItem) NavTitle

func (n *ChatNavItem) NavTitle() string

func (*ChatNavItem) Page

func (n *ChatNavItem) Page() Page

func (*ChatNavItem) ReplaceChildren

func (n *ChatNavItem) ReplaceChildren(children []NavItem)

func (*ChatNavItem) URL

func (n *ChatNavItem) URL() PageURL

func (*ChatNavItem) UpdateAndNavigate

func (n *ChatNavItem) UpdateAndNavigate()

UpdateAndNavigate when a contact is created or deleted,

it should be called for setting selectedNavItem

type ChatPage

type ChatPage struct {
	widget.List
	*AppManager
	Theme *material.Theme
	// contains filtered or unexported fields
}

ChatPage Always call NewChatPage function to create ChatPage page

func NewChatPage

func NewChatPage(manager *AppManager, th *material.Theme) *ChatPage

NewChatPage Always call this function to create ChatPage page

func (*ChatPage) Actions

func (nc *ChatPage) Actions() []component.AppBarAction

func (*ChatPage) DrawAppBar

func (nc *ChatPage) DrawAppBar(gtx Gtx) Dim

func (*ChatPage) Layout

func (nc *ChatPage) Layout(gtx Gtx) Dim

func (*ChatPage) Overflow

func (nc *ChatPage) Overflow() []component.OverflowAction

type ChatRoomNavItem

type ChatRoomNavItem struct {
	*AppManager
	Name string
	Icon *widget.Icon

	widget.Clickable
	*material.Theme
	ThemeAlt *material.Theme
	Accordion
	// contains filtered or unexported fields
}

func NewChatRoomItem

func NewChatRoomItem(manager *AppManager, theme *material.Theme, navTitle string) *ChatRoomNavItem

func (*ChatRoomNavItem) AddChild

func (n *ChatRoomNavItem) AddChild(item NavItem)

func (*ChatRoomNavItem) Children

func (n *ChatRoomNavItem) Children() []NavItem

func (*ChatRoomNavItem) IsSelected

func (n *ChatRoomNavItem) IsSelected() bool

func (*ChatRoomNavItem) Layout

func (n *ChatRoomNavItem) Layout(gtx Gtx) Dim

func (*ChatRoomNavItem) NavTitle

func (n *ChatRoomNavItem) NavTitle() string

func (*ChatRoomNavItem) OnClick

func (n *ChatRoomNavItem) OnClick()

func (*ChatRoomNavItem) Page

func (n *ChatRoomNavItem) Page() Page

func (*ChatRoomNavItem) ReplaceChildren

func (n *ChatRoomNavItem) ReplaceChildren(children []NavItem)

func (*ChatRoomNavItem) URL

func (n *ChatRoomNavItem) URL() PageURL

type ChatRoomPage

type ChatRoomPage struct {
	layout.List
	*AppManager
	Theme *material.Theme

	Title string
	// contains filtered or unexported fields
}

ChatRoomPage Always call NewChatRoomPage function to create ChatRoomPage page

func NewChatRoomPage

func NewChatRoomPage(manager *AppManager, th *material.Theme) *ChatRoomPage

NewChatRoomPage Always call this function to create ChatRoomPage page

func (*ChatRoomPage) Actions

func (cp *ChatRoomPage) Actions() []component.AppBarAction

func (*ChatRoomPage) DrawAppBar

func (cp *ChatRoomPage) DrawAppBar(gtx Gtx) Dim

func (*ChatRoomPage) Layout

func (cp *ChatRoomPage) Layout(gtx Gtx) Dim

func (*ChatRoomPage) Overflow

func (cp *ChatRoomPage) Overflow() []component.OverflowAction

type ChatRoomPageItem

type ChatRoomPageItem struct {
	service.Message
	*material.Theme
}

func (*ChatRoomPageItem) Layout

func (c *ChatRoomPageItem) Layout(gtx Gtx) (d Dim)

type DetailRow

type DetailRow struct {
	// PrimaryWidth is the fraction of the available width that should
	// be allocated to the primary widget. It should be in the range
	// (0,1.0]. Defaults to 0.3 if not set.
	PrimaryWidth float32
	// Inset is automatically applied to both widgets. This inset is
	// required, and will default to a uniform 8DP inset if not set.
	layout.Inset
}

DetailRow lays out two widgets in a horizontal row, with the left widget considered the "Primary" widget.

func (DetailRow) Layout

func (d DetailRow) Layout(gtx Gtx, primary, detail layout.Widget) Dim

Layout the DetailRow with the provided widgets.

type Dim

type Dim = layout.Dimensions

type ErrorView

type ErrorView struct {
	*material.Theme
	*AppManager
	Error string
}

func (*ErrorView) Layout

func (i *ErrorView) Layout(gtx Gtx) (d Dim)

type Gtx

type Gtx = layout.Context

type IDDetailsView

type IDDetailsView struct {
	*material.Theme

	*AppManager
	Contents string
	// contains filtered or unexported fields
}

func (*IDDetailsView) Layout

func (i *IDDetailsView) Layout(gtx Gtx) (d Dim)

type IDListItem

type IDListItem struct {
	*material.Theme

	Selected bool
	*AppManager
	// contains filtered or unexported fields
}

func (*IDListItem) Layout

func (i *IDListItem) Layout(gtx Gtx, index int) Dim

type IDPage

type IDPage struct {
	layout.List
	*AppManager
	Theme *material.Theme
	// contains filtered or unexported fields
}

IDPage Always call NewIDPage function to create IDPage page

func NewIDPage

func NewIDPage(manager *AppManager, th *material.Theme) *IDPage

NewIDPage Always call this function to create IDPage page

func (*IDPage) Actions

func (ids *IDPage) Actions() []component.AppBarAction

func (*IDPage) DrawAppBar

func (ids *IDPage) DrawAppBar(gtx Gtx) Dim

func (*IDPage) Layout

func (ids *IDPage) Layout(gtx Gtx) Dim

func (*IDPage) Overflow

func (ids *IDPage) Overflow() []component.OverflowAction

type IDsNavItem

type IDsNavItem struct {
	*AppManager
	Name string
	Icon *widget.Icon

	widget.Clickable
	*material.Theme
	ThemeAlt *material.Theme
	Accordion
	// contains filtered or unexported fields
}

func NewIDsNavItem

func NewIDsNavItem(manager *AppManager, theme *material.Theme) *IDsNavItem

func (*IDsNavItem) AddChild

func (n *IDsNavItem) AddChild(item *IDsNavItem)

func (*IDsNavItem) Children

func (n *IDsNavItem) Children() []NavItem

func (*IDsNavItem) IsSelected

func (n *IDsNavItem) IsSelected() bool

func (*IDsNavItem) Layout

func (n *IDsNavItem) Layout(gtx Gtx) Dim

func (*IDsNavItem) NavTitle

func (n *IDsNavItem) NavTitle() string

func (*IDsNavItem) OnClick

func (n *IDsNavItem) OnClick()

func (*IDsNavItem) Page

func (n *IDsNavItem) Page() Page

func (*IDsNavItem) ReplaceChildren

func (n *IDsNavItem) ReplaceChildren(children []NavItem)

func (*IDsNavItem) URL

func (n *IDsNavItem) URL() PageURL

type IconButton

type IconButton struct {
	*material.Theme
	Button *widget.Clickable
	Icon   *widget.Icon
	Text   string
}

func (*IconButton) Layout

func (b *IconButton) Layout(gtx Gtx) Dim

type Loader

type Loader struct {
	*material.Theme
}

func (*Loader) Layout

func (l *Loader) Layout(gtx Gtx) Dim
type NavDrawer struct {
	DrawerTitle string
	Subtitle    string
	Anchor      component.VerticalAnchorPosition

	*material.Theme
	*AppManager

	*component.ModalLayer
	*component.ModalSheet
	// contains filtered or unexported fields
}

func NewNavDrawer

func NewNavDrawer(title, subtitle string, manager *AppManager, th *material.Theme, layer *component.ModalLayer) *NavDrawer
func (n *NavDrawer) AddRootNavItem(item NavItem)
func (n *NavDrawer) Appear(when time.Time)
func (n *NavDrawer) Disappear(when time.Time)
func (n *NavDrawer) DrawerItems() []NavItem
func (n *NavDrawer) DrawerLayout(gtx Gtx) Dim
func (n *NavDrawer) DrawerModalLayout() Dim
func (n *NavDrawer) Layout(gtx Gtx) Dim
func (n *NavDrawer) LayoutContents(gtx Gtx, anim *component.VisibilityAnimation) Dim
func (n *NavDrawer) MaxWidth() int
func (n *NavDrawer) SelectedItem() NavItem
func (n *NavDrawer) SetNavDestination(page Page)
func (n *NavDrawer) SetSelectedItem(item NavItem)
func (n *NavDrawer) ToggleVisibility(when time.Time)
type NavItem interface {
	View
	Page() Page
	URL() PageURL
	NavTitle() string
	Children() []NavItem
}

type Page

type Page interface {
	DrawAppBar(gtx Gtx) Dim
	View
}

type PageURL

type PageURL string
const (
	SettingsPageURL   PageURL = "/settings"
	IdentitiesPageURL PageURL = "/identities"
	StartChatPageURL  PageURL = "/new-chat"
	ChatRoomPageURL   PageURL = "/chat"
)

type SettingsNavItem

type SettingsNavItem struct {
	*AppManager
	Name string
	Icon *widget.Icon

	widget.Clickable
	*material.Theme
	Accordion
	// contains filtered or unexported fields
}

func NewSettingsItem

func NewSettingsItem(manager *AppManager, theme *material.Theme) *SettingsNavItem

func (*SettingsNavItem) Children

func (n *SettingsNavItem) Children() []NavItem

func (*SettingsNavItem) ClickCallback

func (n *SettingsNavItem) ClickCallback()

func (*SettingsNavItem) IsSelected

func (n *SettingsNavItem) IsSelected() bool

func (*SettingsNavItem) Layout

func (n *SettingsNavItem) Layout(gtx Gtx) Dim

func (*SettingsNavItem) NavTitle

func (n *SettingsNavItem) NavTitle() string

func (*SettingsNavItem) Page

func (n *SettingsNavItem) Page() Page

func (*SettingsNavItem) URL

func (n *SettingsNavItem) URL() PageURL

type SettingsPage

type SettingsPage struct {
	widget.List
	*AppManager
	Theme *material.Theme
	// contains filtered or unexported fields
}

SettingsPage Always call NewSettingsPage function to create SettingsPage page

func NewSettingsPage

func NewSettingsPage(manager *AppManager, th *material.Theme) *SettingsPage

NewSettingsPage Always call this function to create SettingsPage page

func (*SettingsPage) Actions

func (s *SettingsPage) Actions() []component.AppBarAction

func (*SettingsPage) DrawAppBar

func (s *SettingsPage) DrawAppBar(gtx Gtx) Dim

func (*SettingsPage) Layout

func (s *SettingsPage) Layout(gtx Gtx) Dim

func (*SettingsPage) Overflow

func (s *SettingsPage) Overflow() []component.OverflowAction

type View

type View interface {
	Layout(gtx Gtx) Dim
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL