spacedBy and aligned arrangements for Row/Column
Relnote: The spacedBy Arrangement was added for Row and Column, to enable positioning layout children with a fixed spacing. The aligned Arrangment was also added, to enable positioning layout children one next to the other and aligned in the Row/Column according to an Alignment. The previous Arrangement.Vertical#arrange and Arrangement.Horizontal#arrange methods were deprecated, and writing custom Arrangements will not be supported in the future.
Fixes: 161985975
Fixes: 144976975
Test: RowColumnTest
Change-Id: I6733d4a76e4abd5713bfacf95da696bdd6153932
diff --git a/ui/ui-layout/api/restricted_current.txt b/ui/ui-layout/api/restricted_current.txt
index 2de10aa..8318876a 100644
--- a/ui/ui-layout/api/restricted_current.txt
+++ b/ui/ui-layout/api/restricted_current.txt
@@ -2,97 +2,70 @@
package androidx.compose.foundation.layout {
@androidx.compose.runtime.Immutable public final class AbsoluteArrangement {
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal aligned(androidx.compose.ui.Alignment.Horizontal alignment);
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal getCenter();
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal getLeft();
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal getRight();
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal getSpaceAround();
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal getSpaceBetween();
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal getSpaceEvenly();
+ method public androidx.compose.foundation.layout.Arrangement.HorizontalOrVertical spacedBy-0680j_4(float space);
+ method public androidx.compose.foundation.layout.Arrangement.Vertical spacedBy-6mHxxJo(float space, androidx.compose.ui.Alignment.Vertical alignment);
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal spacedBy-w0p642k(float space, androidx.compose.ui.Alignment.Horizontal alignment);
+ property public final androidx.compose.foundation.layout.Arrangement.Horizontal Center;
+ property public final androidx.compose.foundation.layout.Arrangement.Horizontal Left;
+ property public final androidx.compose.foundation.layout.Arrangement.Horizontal Right;
+ property public final androidx.compose.foundation.layout.Arrangement.Horizontal SpaceAround;
+ property public final androidx.compose.foundation.layout.Arrangement.Horizontal SpaceBetween;
+ property public final androidx.compose.foundation.layout.Arrangement.Horizontal SpaceEvenly;
field public static final androidx.compose.foundation.layout.AbsoluteArrangement INSTANCE;
}
- public static final class AbsoluteArrangement.Center implements androidx.compose.foundation.layout.Arrangement.Horizontal {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- field public static final androidx.compose.foundation.layout.AbsoluteArrangement.Center INSTANCE;
- }
-
- public static final class AbsoluteArrangement.Left implements androidx.compose.foundation.layout.Arrangement.Horizontal {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- field public static final androidx.compose.foundation.layout.AbsoluteArrangement.Left INSTANCE;
- }
-
- public static final class AbsoluteArrangement.Right implements androidx.compose.foundation.layout.Arrangement.Horizontal {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- field public static final androidx.compose.foundation.layout.AbsoluteArrangement.Right INSTANCE;
- }
-
- public static final class AbsoluteArrangement.SpaceAround implements androidx.compose.foundation.layout.Arrangement.Horizontal {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- field public static final androidx.compose.foundation.layout.AbsoluteArrangement.SpaceAround INSTANCE;
- }
-
- public static final class AbsoluteArrangement.SpaceBetween implements androidx.compose.foundation.layout.Arrangement.Horizontal {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- field public static final androidx.compose.foundation.layout.AbsoluteArrangement.SpaceBetween INSTANCE;
- }
-
- public static final class AbsoluteArrangement.SpaceEvenly implements androidx.compose.foundation.layout.Arrangement.Horizontal {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- field public static final androidx.compose.foundation.layout.AbsoluteArrangement.SpaceEvenly INSTANCE;
- }
-
public final class AlignmentLineKt {
method @androidx.compose.runtime.Stable public static androidx.compose.ui.Modifier relativePaddingFrom-7P-br3g(androidx.compose.ui.Modifier, androidx.compose.ui.AlignmentLine alignmentLine, float before = Dp.Unspecified, float after = Dp.Unspecified);
}
@androidx.compose.runtime.Immutable public final class Arrangement {
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal aligned(androidx.compose.ui.Alignment.Horizontal alignment);
+ method public androidx.compose.foundation.layout.Arrangement.Vertical aligned(androidx.compose.ui.Alignment.Vertical alignment);
+ method public androidx.compose.foundation.layout.Arrangement.Vertical getBottom();
+ method public androidx.compose.foundation.layout.Arrangement.HorizontalOrVertical getCenter();
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal getEnd();
+ method public androidx.compose.foundation.layout.Arrangement.HorizontalOrVertical getSpaceAround();
+ method public androidx.compose.foundation.layout.Arrangement.HorizontalOrVertical getSpaceBetween();
+ method public androidx.compose.foundation.layout.Arrangement.HorizontalOrVertical getSpaceEvenly();
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal getStart();
+ method public androidx.compose.foundation.layout.Arrangement.Vertical getTop();
+ method public androidx.compose.foundation.layout.Arrangement.HorizontalOrVertical spacedBy-0680j_4(float space);
+ method public androidx.compose.foundation.layout.Arrangement.Vertical spacedBy-6mHxxJo(float space, androidx.compose.ui.Alignment.Vertical alignment);
+ method public androidx.compose.foundation.layout.Arrangement.Horizontal spacedBy-w0p642k(float space, androidx.compose.ui.Alignment.Horizontal alignment);
+ property public final androidx.compose.foundation.layout.Arrangement.Vertical Bottom;
+ property public final androidx.compose.foundation.layout.Arrangement.HorizontalOrVertical Center;
+ property public final androidx.compose.foundation.layout.Arrangement.Horizontal End;
+ property public final androidx.compose.foundation.layout.Arrangement.HorizontalOrVertical SpaceAround;
+ property public final androidx.compose.foundation.layout.Arrangement.HorizontalOrVertical SpaceBetween;
+ property public final androidx.compose.foundation.layout.Arrangement.HorizontalOrVertical SpaceEvenly;
+ property public final androidx.compose.foundation.layout.Arrangement.Horizontal Start;
+ property public final androidx.compose.foundation.layout.Arrangement.Vertical Top;
field public static final androidx.compose.foundation.layout.Arrangement INSTANCE;
}
- public static final class Arrangement.Bottom implements androidx.compose.foundation.layout.Arrangement.Vertical {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size);
- field public static final androidx.compose.foundation.layout.Arrangement.Bottom INSTANCE;
+ @androidx.compose.foundation.layout.InternalLayoutApi public static interface Arrangement.Horizontal {
+ method public void arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection, androidx.compose.ui.unit.Density density, java.util.List<java.lang.Integer> outPosition);
+ method @Deprecated public default java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
+ method public default float getSpacing();
+ property public default float spacing;
}
- public static final class Arrangement.Center implements androidx.compose.foundation.layout.Arrangement.Horizontal androidx.compose.foundation.layout.Arrangement.Vertical {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size);
- field public static final androidx.compose.foundation.layout.Arrangement.Center INSTANCE;
+ @androidx.compose.foundation.layout.InternalLayoutApi public static interface Arrangement.HorizontalOrVertical extends androidx.compose.foundation.layout.Arrangement.Horizontal androidx.compose.foundation.layout.Arrangement.Vertical {
+ property public default float spacing;
}
- public static final class Arrangement.End implements androidx.compose.foundation.layout.Arrangement.Horizontal {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- field public static final androidx.compose.foundation.layout.Arrangement.End INSTANCE;
- }
-
- public static interface Arrangement.Horizontal {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- }
-
- public static final class Arrangement.SpaceAround implements androidx.compose.foundation.layout.Arrangement.Horizontal androidx.compose.foundation.layout.Arrangement.Vertical {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size);
- field public static final androidx.compose.foundation.layout.Arrangement.SpaceAround INSTANCE;
- }
-
- public static final class Arrangement.SpaceBetween implements androidx.compose.foundation.layout.Arrangement.Horizontal androidx.compose.foundation.layout.Arrangement.Vertical {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size);
- field public static final androidx.compose.foundation.layout.Arrangement.SpaceBetween INSTANCE;
- }
-
- public static final class Arrangement.SpaceEvenly implements androidx.compose.foundation.layout.Arrangement.Horizontal androidx.compose.foundation.layout.Arrangement.Vertical {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size);
- field public static final androidx.compose.foundation.layout.Arrangement.SpaceEvenly INSTANCE;
- }
-
- public static final class Arrangement.Start implements androidx.compose.foundation.layout.Arrangement.Horizontal {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.LayoutDirection layoutDirection);
- field public static final androidx.compose.foundation.layout.Arrangement.Start INSTANCE;
- }
-
- public static final class Arrangement.Top implements androidx.compose.foundation.layout.Arrangement.Vertical {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size);
- field public static final androidx.compose.foundation.layout.Arrangement.Top INSTANCE;
- }
-
- public static interface Arrangement.Vertical {
- method public java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size);
+ @androidx.compose.foundation.layout.InternalLayoutApi public static interface Arrangement.Vertical {
+ method public void arrange(int totalSize, java.util.List<java.lang.Integer> size, androidx.compose.ui.unit.Density density, java.util.List<java.lang.Integer> outPosition);
+ method @Deprecated public default java.util.List<java.lang.Integer> arrange(int totalSize, java.util.List<java.lang.Integer> size);
+ method public default float getSpacing();
+ property public default float spacing;
}
public final class ChainStyle {
@@ -374,6 +347,9 @@
method public float getTop();
}
+ @kotlin.RequiresOptIn(message="This is an internal layout API subject to change and should not be used directly.") public @interface InternalLayoutApi {
+ }
+
public final class IntrinsicKt {
method @Deprecated @androidx.compose.runtime.Composable public static void MaxIntrinsicHeight(kotlin.jvm.functions.Function0<kotlin.Unit> children);
method @Deprecated @androidx.compose.runtime.Composable public static void MaxIntrinsicWidth(kotlin.jvm.functions.Function0<kotlin.Unit> children);
@@ -450,7 +426,7 @@
}
public final class RowColumnImplKt {
- method @kotlin.PublishedApi internal static androidx.compose.ui.node.LayoutNode.MeasureBlocks rowColumnMeasureBlocks(androidx.compose.foundation.layout.LayoutOrientation orientation, kotlin.jvm.functions.Function3<? super java.lang.Integer,? super java.util.List<java.lang.Integer>,? super androidx.compose.ui.unit.LayoutDirection,? extends java.util.List<java.lang.Integer>> arrangement, androidx.compose.foundation.layout.SizeMode crossAxisSize, androidx.compose.foundation.layout.CrossAxisAlignment crossAxisAlignment);
+ method @kotlin.PublishedApi internal static androidx.compose.ui.node.LayoutNode.MeasureBlocks rowColumnMeasureBlocks-GZ6WFlY(androidx.compose.foundation.layout.LayoutOrientation orientation, kotlin.jvm.functions.Function5<? super java.lang.Integer,? super java.util.List<java.lang.Integer>,? super androidx.compose.ui.unit.LayoutDirection,? super androidx.compose.ui.unit.Density,? super java.util.List<java.lang.Integer>,kotlin.Unit> arrangement, float arrangementSpacing, androidx.compose.foundation.layout.SizeMode crossAxisSize, androidx.compose.foundation.layout.CrossAxisAlignment crossAxisAlignment);
}
public final class RowKt {