WidgetText
Text element shown in a widget.
A text shown in a widget. You do not create instances of this element directly. Instead you should call addText() on an instance of a ListWidget.
Properties
Section titled “Properties”Font and text size of the text.
font: FontlineLimit
Section titled “lineLimit”Maximum number of lines.
lineLimit: numberMaximum number of lines to display. The limit is disabled when the value is 0 or less. Defaults to 0.
minimumScaleFactor
Section titled “minimumScaleFactor”Minimum amount the text scales down to.
minimumScaleFactor: numberSets the minimum amount that text scales down to fit in the available space. For example, a text with a minimum scale factor of 0.5 allows the widget to draw the text in a font size half the size of the actual font. The scale factor should be a fraction between 0 and 1, both inclusive. Defaults to 1.
shadowColor
Section titled “shadowColor”Color of the shadow.
shadowColor: ColorSets the color of the shadow cast by the text. The shadowRadius property must have a value greater than zero for this property to have an effect. Defaults to black.
shadowOffset
Section titled “shadowOffset”Offset of the shadow.
shadowOffset: PointSets the offset of the shadow cast by the text. The shadowRadius property must have a value greater than zero for this property to have an effect. Defaults to (0, 0).
shadowRadius
Section titled “shadowRadius”Size of the shadow.
shadowRadius: numberSets the size of the shadow cast by the text. Defaults to 0.
Text to show in a widget.
text: stringtextColor
Section titled “textColor”Color of the text.
textColor: ColortextOpacity
Section titled “textOpacity”Opacity of the text.
textOpacity: numberOpacity of the text. This must be a value between 0 and 1. Defaults to 1.
URL to open.
url: stringThe URL will be opened when the text is tapped. This is only supported in medium and large widgets. Small widgets can only have a single tap target, which is specified by the url on the widget.
Methods
Section titled “Methods”
centerAlignText()
Section titled “centerAlignText()”Center aligns the text.
centerAlignText()Specifies that text should be center aligned.
This does not affect texts placed in stacks. Use spacers instead when aligning text in stacks. To align the text in the center of a horizontal stack, you should place a spacer both before and after the text.
leftAlignText()
Section titled “leftAlignText()”Left aligns the text.
leftAlignText()Specifies that text should be left aligned. This is the default.
This does not affect texts placed in stacks. Use spacers instead when aligning text in stacks. To align the text to left right in a horizontal stack, you should place a spacer after the text.
rightAlignText()
Section titled “rightAlignText()”Right aligns the text.
rightAlignText()Specifies that text should be right aligned.
This does not affect texts placed in stacks. Use spacers instead when aligning text in stacks. To align the text to the right in a horizontal stack, you should place a spacer before the text.