Fixed
Status Update
Comments
be...@gmail.com <be...@gmail.com> #2
Flutter also has this issue.
- There is a question with 68k views, and
is to just use SizedBox.the approved answer - There was a
, with 117 thumbs up (a lot!) and closed; the official wording is user should wrapGitHub issue and reuse it everywhere, or someone should make a package. Still, less intuitive than having an itemSpacing attribute (their solution adds one more level of nesting!) and many people (read: enterprise) will have a hard time importing and approving libraries for basic stuff that the framework should provide.two lines into a function - Now there is a
supports spacing but the individual Row/Columns doesn't (should be as simple as adding the attribute and passing to the Wrap they use internally).discussion why Wrap
Additionally, I am making a
- Maintainability: when users modify one SizedBox, they will need to also modify the others.
- Reusability: itemSpacing(8) seems a lot better than 5 SizedBox(width: 5) which are error prone (specially when adding and removing items! You need to add the SizedBox too! You can't reuse the same views everywhere). And when using ForEach, you need to add an array with the view + SizedBox.
- Learnability: if the framework can't handle what I want, I'm going to solve with the least amount of effort. No one will add that function, reference it, test it, etc. SizedBox is enough. But then people will end with more bloated code.
- Interoperability: CSS has itemSpacing. Custom CSS frameworks like Tailwind (which strip out most of CSS) also has it. SwiftUI has it. Many users coming from other platforms will desire it.
ap...@google.com <ap...@google.com> #3
Project: platform/frameworks/support
Branch: androidx-master-dev
commit bc17985ca89fc0a57a75635a45f273c5c5701692
Author: Mihai Popa <popam@google.com>
Date: Thu Aug 06 16:07:18 2020
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
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/Box.kt
M ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
M ui/ui-layout/api/current.txt
M ui/ui-layout/api/public_plus_experimental_current.txt
M ui/ui-layout/api/restricted_current.txt
M ui/ui-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/LayoutTest.kt
M ui/ui-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnTest.kt
M ui/ui-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Column.kt
M ui/ui-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Flow.kt
M ui/ui-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/OptInLayoutApi.kt
M ui/ui-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Row.kt
M ui/ui-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/RowColumnImpl.kt
M ui/ui-tooling/src/main/java/androidx/ui/tooling/inspector/ParameterFactory.kt
https://android-review.googlesource.com/1393098
Branch: androidx-master-dev
commit bc17985ca89fc0a57a75635a45f273c5c5701692
Author: Mihai Popa <popam@google.com>
Date: Thu Aug 06 16:07:18 2020
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
M ui/ui-foundation/api/current.txt
M ui/ui-foundation/api/public_plus_experimental_current.txt
M ui/ui-foundation/api/restricted_current.txt
M ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/Box.kt
M ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/Scroll.kt
M ui/ui-layout/api/current.txt
M ui/ui-layout/api/public_plus_experimental_current.txt
M ui/ui-layout/api/restricted_current.txt
M ui/ui-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/LayoutTest.kt
M ui/ui-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/RowColumnTest.kt
M ui/ui-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Column.kt
M ui/ui-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Flow.kt
M ui/ui-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/OptInLayoutApi.kt
M ui/ui-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/Row.kt
M ui/ui-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/RowColumnImpl.kt
M ui/ui-tooling/src/main/java/androidx/ui/tooling/inspector/ParameterFactory.kt
Description
Context: