widget
go
import "github.com/tangoui/tango/sys/widget"本页由
site/tools/apigen从源码注释生成(按 darwin 构建标签选文件),请勿手改。
Package widget updates the app's home-screen widget.
widget.Update(a, widget.Content{Title: "Inbox", Text: "3 unread"})
Android: the host's AppWidget (org.tango.host.TangoWidget), added to the manifest when tan.json "permissions" lists "widget". It shows a title and a text; tapping it opens the app. The content is stored and survives restarts and reboots, so the widget shows the last value even while the app is not running.
iOS widgets are WidgetKit extensions written in SwiftUI and are not built by tan yet (see docs/specs/mobile-extensions.md): Update returns ErrUnsupported there, as on desktop.
变量
go
var (
ErrUnsupported = platform.ErrUnsupported
ErrNotConfigured = platform.ErrNotConfigured // the app does not declare the widget
)函数
func Update
go
func Update(a *tango.App, c Content) errorUpdate replaces what the widget shows.
类型
Content
go
type Content = platform.WidgetContent