Class “LayoutData”

Object > LayoutData

Provides layout information for a widget to be used by the parent widget when determining its size and position. See also LayoutDataValue

Type: LayoutData extends Object
Constructor: public
Singleton: No
Namespace: tabris
Direct subclasses: None
JSX Support: No

Examples

JavaScript

import {LayoutData} from 'tabris';

const layoutData = LayoutData.from({left: 16, right: '20%', height: 128});
console.log(layoutData.height); // "128"

Constructor

new LayoutData(parameters)

Parameter Type Description
parameters LayoutDataProperties An object containing some or all LayoutData properties. Constraints have to be instances of the Constraint class. Any omitted property defaults to ‘auto’.

Methods

equals(value)

Tests if the given value is a LayoutData instance that is deeply equal to this one.

Parameter Type Description
value LayoutData  

Returns: boolean

toString()

Returns a string representation of LayoutData.

Returns: string

Static Methods

from(layoutDataValue)

Creates a new instance of LayoutData using any valid layoutData expression. For any other value, including null, the method throws.

Parameter Type Description
layoutDataValue LayoutDataValue The value to create

Returns: LayoutData

Properties

baseline

The vertical position of the widget’s baseline relative to a sibling widget.

Type: SiblingReference | 'auto'
Default: 'auto'
Settable: No

This property can only be set via constructor. Once set, it cannot change anymore.

bottom

The position of the widget’s bottom edge relative to the parent or a sibling widget. Must not be negative.

Type: Constraint | 'auto'
Default: 'auto'
Settable: No

This property can only be set via constructor. Once set, it cannot change anymore.

centerX

The horizontal position of the widget’s center relative to the parent’s center.

Type: Offset | 'auto'
Default: 'auto'
Settable: No

This property can only be set via constructor. Once set, it cannot change anymore.

centerY

The vertical position of the widget’s center relative to the parent’s center.

Type: Offset | 'auto'
Default: 'auto'
Settable: No

This property can only be set via constructor. Once set, it cannot change anymore.

height

The height of the widget.

Type: Dimension | 'auto'
Default: 'auto'
Settable: No

This property can only be set via constructor. Once set, it cannot change anymore.

left

The position of the widget’s left edge relative to the parent or a sibling widget. Must not be negative.

Type: Constraint | 'auto'
Default: 'auto'
Settable: No

This property can only be set via constructor. Once set, it cannot change anymore.

The position of the widget’s right edge relative to the parent or a sibling widget. Must not be negative.

Type: Constraint | 'auto'
Default: 'auto'
Settable: No

This property can only be set via constructor. Once set, it cannot change anymore.

top

The position of the widget’s top edge relative to the parent or a sibling widget. Must not be negative.

Type: Constraint | 'auto'
Default: 'auto'
Settable: No

This property can only be set via constructor. Once set, it cannot change anymore.

width

The width of the widget.

Type: Dimension | 'auto'
Default: 'auto'
Settable: No

This property can only be set via constructor. Once set, it cannot change anymore.

Static Properties

center

An instance of LayoutData that centers a widget horizontally and vertically. Equivalent to LayoutData.from({centerX: 0, centerY: 0})

Type: LayoutData
Settable: No

next

A SiblingReference indicating the next widget in the list of children attached to the same parent. Used by the baseline property. An alias of Constraint.next.

Type: typeof Constraint.next
Settable: No

prev

A SiblingReference indicating the previous widget in the list of children attached to the same parent. Used by the baseline property. An alias of Constraint.next.

Type: typeof Constraint.prev
Settable: No

stretch

An instance of LayoutData that makes a widget fill the inner width and height of its parent (padding excluded). Equivalent to LayoutData.from({left: 0, top: 0, right: 0, bottom: 0}).

Type: LayoutData
Settable: No

stretchX

An instance of LayoutData that makes a widget as wide as its parent (padding excluded). Equivalent to LayoutData.from({left: 0, right: 0}).

Type: LayoutData
Settable: No

stretchY

An instance of LayoutData that makes a widget as high as its parent (padding excluded). Equivalent to LayoutData.from({top: 0, bottom: 0}).

Type: LayoutData
Settable: No