Documentation
¶
Index ¶
- Constants
- Variables
- type Alignment
- type BasicTextConstructorArgs
- type Composable
- type Composer
- type InlineTextContent
- type TextAutoSize
- type TextAutoSizeLayoutScope
- type TextAutoSizeValues
- type TextOption
- func WithAutoSize(autoSize TextAutoSize) TextOption
- func WithColor(color graphics.Color) TextOption
- func WithMaxLines(maxLines int) TextOption
- func WithMinLines(minLines int) TextOption
- func WithModifier(m ui.Modifier) TextOption
- func WithOnTextLayout(onTextLayout func(text.TextLayoutResult)) TextOption
- func WithOverFlow(overFlow style.TextOverFlow) TextOption
- func WithSoftWrap(softWrap bool) TextOption
- func WithTextStyle(ts *text.TextStyle) TextOption
- type TextOptions
- type TextStyle
- type WrapPolicy
Constants ¶
View Source
const BasicTextNodeID = "BasicText"
View Source
const INLINE_CONTENT_TAG = "compose.foundation.text.inlineContent"
* The annotation tag used by inline content.
View Source
const REPLACEMENT_CHAR = "\uFFFD"
A string that contains a replacement character specified by unicode. It's used as the default value of alternate text.
Variables ¶
View Source
var TextAutoSizeDefaults = TextAutoSizeValues{
MinFontSize: uiTextUnitSp(12),
MaxFontSize: uiTextUnitSp(112),
StepSize: uiTextUnitSp(0.25),
}
TextAutoSizeDefaults contains defaults for TextAutoSize APIs.
Functions ¶
This section is empty.
Types ¶
type BasicTextConstructorArgs ¶
type BasicTextConstructorArgs struct {
// contains filtered or unexported fields
}
type Composable ¶
type Composable = api.Composable
func BasicText ¶
func BasicText( annotatedString text.AnnotatedString, options ...TextOption, ) Composable
func Text ¶
func Text(value string, options ...TextOption) Composable
Text renders a text leaf. The value is stored in a slot for tooling.
type InlineTextContent ¶
type InlineTextContent struct {
/**
* The setting object that defines the size and vertical alignment of this composable in the
* text line. This is different from the measure of Layout
*
* @see Placeholder
*/
PlaceHolder uiPlaceholder
/**
* The composable to be inserted into the text layout. The string parameter passed to it will
* the alternateText given to [appendInlineContent].
*/
Children []func(string) Composable
}
type TextAutoSize ¶
type TextAutoSize interface {
GetFontSize(scope TextAutoSizeLayoutScope, constraints uiConstraints, text uiAnnotatedString) uiTextUnit
}
func NewStepBasedTextAutoSize ¶
func NewStepBasedTextAutoSize( minFontSize uiTextUnit, maxFontSize uiTextUnit, stepSize uiTextUnit, ) TextAutoSize
NewStepBasedTextAutoSize automatically sizes the text with the biggest font size that fits the available space.
type TextAutoSizeLayoutScope ¶
type TextAutoSizeLayoutScope interface {
PerformLayout(constraints uiConstraints, text uiAnnotatedString, fontSize uiTextUnit) uiTextLayoutResult
}
type TextAutoSizeValues ¶
type TextAutoSizeValues struct {
MinFontSize uiTextUnit
MaxFontSize uiTextUnit
StepSize uiTextUnit
}
type TextOption ¶
type TextOption func(*TextOptions)
func WithAutoSize ¶
func WithAutoSize(autoSize TextAutoSize) TextOption
func WithColor ¶
func WithColor(color graphics.Color) TextOption
func WithMaxLines ¶
func WithMaxLines(maxLines int) TextOption
func WithMinLines ¶
func WithMinLines(minLines int) TextOption
func WithModifier ¶
func WithModifier(m ui.Modifier) TextOption
func WithOnTextLayout ¶
func WithOnTextLayout(onTextLayout func(text.TextLayoutResult)) TextOption
func WithOverFlow ¶
func WithOverFlow(overFlow style.TextOverFlow) TextOption
func WithSoftWrap ¶
func WithSoftWrap(softWrap bool) TextOption
func WithTextStyle ¶
func WithTextStyle(ts *text.TextStyle) TextOption
type TextOptions ¶
type TextOptions struct {
Modifier ui.Modifier
TextStyle *text.TextStyle
OnTextLayout func(text.TextLayoutResult)
OverFlow style.TextOverFlow
SoftWrap bool
MaxLines int
MinLines int
InlineContent map[string]InlineTextContent
Color graphics.Color
AutoSize TextAutoSize
}
func DefaultTextOptions ¶
func DefaultTextOptions() TextOptions
type WrapPolicy ¶
type WrapPolicy = text.WrapPolicy
WrapPolicy configures strategies for choosing where to break lines of text for line wrapping.
const ( // WrapHeuristically tries to minimize breaking within words (UAX#14 text segments) // while also ensuring that text fits within the given MaxWidth. It will only break // a line within a word (on a UAX#29 grapheme cluster boundary) when that word cannot // fit on a line by itself. Additionally, when the final word of a line is being // truncated, this policy will preserve as many symbols of that word as // possible before the truncator. WrapHeuristically WrapPolicy = text.WrapHeuristically // WrapWords does not permit words (UAX#14 text segments) to be broken across lines. // This means that sometimes long words will exceed the MaxWidth they are wrapped with. WrapWords WrapPolicy = text.WrapWords // WrapGraphemes will maximize the amount of text on each line at the expense of readability, // breaking any word across lines on UAX#29 grapheme cluster boundaries to maximize the number of // grapheme clusters on each line. WrapGraphemes WrapPolicy = text.WrapGraphemes )
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package input provides text field state management and editing infrastructure.
|
Package input provides text field state management and editing infrastructure. |
|
internal
Package internal provides internal implementation details for text input.
|
Package internal provides internal implementation details for text input. |
|
internal/selection
Package selection provides selection state management for text fields.
|
Package selection provides selection state management for text fields. |
|
internal/undo
Package undo provides undo/redo infrastructure for text editing.
|
Package undo provides undo/redo infrastructure for text editing. |
|
Package modifiers provides text modifier implementations for foundation text components.
|
Package modifiers provides text modifier implementations for foundation text components. |
|
Package selection provides text selection functionality for Compose Foundation.
|
Package selection provides text selection functionality for Compose Foundation. |
Click to show internal directories.
Click to hide internal directories.