WidgetStack

Stack element shown in widget.

Shows a stack in the widget.

backgroundColor

Background color of the widget.

backgroundColor: Color

backgroundImage

Background image.

backgroundImage: Image

backgroundGradient

Background gradient.

backgroundGradient: LinearGradient

spacing

Spacing between elements.

Specifies the spacing between elements in the stack. You can also use the addSpacer() function on the widget to add spacing between elements. Defaults to 0.

spacing: number

size

Size of the stack.

Specifies the size of the stack when shown in a widget. When a dimension is set to zero or less, the widget will automatically decide a length for that dimension. Both dimensions default to 0.

size: Size

cornerRadius

Radius of the corners.

Radius of the rounded corners. Defaults to 0.

cornerRadius: number

borderWidth

Border width.

Width of the border around the stack. Defaults to 0.

borderWidth: number

borderColor

Border color.

Color of the border around the stack. Defaults to black.

borderColor: Color

url

URL to open.

The 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.

url: string

-addText

Add text to the stack.

addText(text: string): WidgetText

Adds a text element to the stack. Use the properties on the returned element to style the text.

Return value

WidgetText
Text element.


-addDate

Add date to the widget.

addDate(date: Date): WidgetDate

Adds a date element to the widget. Use the properties on the returned element to style the date.

Return value

WidgetDate
Date element.


-addImage

Add image to the stack.

addImage(image: Image): WidgetImage

Adds an image element to the stack. Use the properties on the returned element to style the image.

Return value

WidgetImage
Image element.


-addSpacer

Add spacer.

addSpacer(length: number): WidgetSpacer

Adds a spacer to the stack. This can be used to offset the content horizontally in the stack.

Parameters

length
number
Length of the spacer. Pass null to create a spacer with a flexible length.

Return value

WidgetSpacer
Spacer element.


-addStack

Add stack.

addStack(): WidgetStack

Adds a stack to the widget. Stacks layout elements horizontally by default.

Return value

WidgetStack
Stack element.


-setPadding

Set padding.

setPadding(top: number, leading: number, bottom: number, trailing: number)

Sets the padding on each side of the stack.

Parameters

top
number
Padding on the top edge.

leading
number
Padding on the leading edge.

bottom
number
Padding on the bottom edge.

trailing
number
Padding on the trailing edge.


-useDefaultPadding

Use the default padding.

useDefaultPadding()

Configure the stack to use the default padding. Any padding previously defined with setPadding() will be discarded.


-topAlignContent

Top aligns the content.

topAlignContent()

Specifies that content should be top aligned. This is the default.


-centerAlignContent

Center aligns the content.

centerAlignContent()

Specifies that content should be center aligned.


-bottomAlignContent

Bottom aligns the content.

bottomAlignContent()

Specifies that content should be bottom aligned.


-layoutHorizontally

Layout elements horizontally.

layoutHorizontally()

Specifies that the stack should layout elements horizontally. This is the default.


-layoutVertically

Layout elements vertically.

layoutVertically()

Specifies that the stack should layout elements vertically.