类型 InputOTPSnapshot

API 文档由 Go 源码生成,内容为英文。

type InputOTPSnapshot struct {
	ID            ui.ID
	Label         string
	Value         string
	DisplayValue  string
	Hint          string
	Slots         int
	GroupSize     int
	Disabled      bool
	ReadOnly      bool
	Invalid       bool
	Focused       bool
	NativeEditing bool
	// PlatformInput lets the platform text service edit the code through an
	// invisible one-pixel editor beside the active slot (which is also where an
	// IME places its candidate window), while the caller keeps painting the
	// slots from its own editor. Contrast NativeEditing, where the platform
	// draws the text itself and the slots paint none.
	PlatformInput    bool
	HasActiveSlot    bool
	ActiveSlot       int
	ShowCaret        bool
	HasSelection     bool
	SelectionStart   int
	SelectionEnd     int
	HasComposition   bool
	CompositionStart int
	CompositionEnd   int
}

InputOTPSnapshot is a caller-owned one-time-code presentation. Slot focus, selection, composition, and caret visibility are snapshots only; this recipe does not run an editor, IME, timer, or caret animation.

方法

Semantics#

func (snapshot InputOTPSnapshot) Semantics() InputOTPSemantics

Semantics returns a normalized, allocation-free snapshot without claiming that the platform currently renders slot-shaped native editors.