Flex Layout
Note:
Currently in the beta phase.
Note:
Only takes effect when the parent component is Flex, Column, Row, or GridRow (specifically for alignSelf).
Import Module
import kit.ArkUI.*
func alignSelf(?ItemAlign)
func alignSelf(value: ?ItemAlign): T
Function: Alignment format of child components along the cross axis of the parent container.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value | ?ItemAlign | Yes | - | Alignment format of child components along the cross axis of the parent container, overriding the alignItems setting in Flex, Column, Row, and GridRow layout containers. GridCol can bind the alignsSelf property to change its layout along the cross axis. Initial value: ItemAlign.Auto. |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that called this interface. |
func flexBasis(?Length)
func flexBasis(value: ?Length): T
Function: Sets the base size of the component.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value | ?Length | Yes | - | Base size of the component along the main axis of the parent container. Initial value: LengthMetrics.AUTO (indicating that the base size of the component along the main axis is the component's original size). Setting percent is not supported. Value range: (0, +∞), default unit is vp. Abnormal values: The actual layout effect is consistent with LengthMetrics.AUTO. |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that called this interface. |
func flexGrow(?Float64)
func flexGrow(value: ?Float64): T
Function: Sets the proportion of remaining space in the parent container allocated to the component.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value | ?Float64 | Yes | - | Proportion of remaining space along the main axis of the parent container allocated to the component where this property is set. Range: (0,+∞), Initial value: 0.0. |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that called this interface. |
func flexGrow(?Int64)
func flexGrow(value: ?Int64): T
Function: Sets the proportion of remaining space in the parent container allocated to the component.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value | ?Int64 | Yes | - | Proportion of remaining space along the main axis of the parent container allocated to the component where this property is set. Range: (0,+∞), Initial value: 0. |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that called this interface. |
func flexShrink(?Float64)
func flexShrink(value: ?Float64): T
Function: Sets the proportion of compressed size in the parent container allocated to the component where this property is set. When the parent container is Column or Row, the size along the main axis must be set.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value | ?Float64 | Yes | - | Proportion of compressed size in the parent container allocated to the component where this property is set. When the parent container is Column or Row, range: (0,+∞), initial value: 0.0. When the parent container is Flex, initial value: 1.0. constraintSize limits the size range of the component. Even if constraintSize is set for Column and Row, when the main axis size (width/height/size) is not set, the default layout behavior is followed, adapting to the child component size along the main axis, and flexShrink does not take effect. |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that called this interface. |
func flexShrink(?Int64)
func flexShrink(value: ?Int64): T
Function: Sets the proportion of compressed size in the parent container allocated to the component where this property is set. When the parent container is Column or Row, the size along the main axis must be set.
System Capability: SystemCapability.ArkUI.ArkUI.Full
Since: 22
Parameters:
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| value | ?Int64 | Yes | - | Proportion of compressed size in the parent container allocated to the component where this property is set. When the parent container is Column or Row, initial value: 0. When the parent container is Flex, initial value: 1. |
Return Value:
| Type | Description |
|---|---|
| T | Returns the component instance itself that called this interface. |