Fixed
Status Update
Comments
ap...@google.com <ap...@google.com> #2
Project: platform/frameworks/support
Branch: androidx-master-dev
commit 93f2a80d7b4c7b3f80f0726f082e36fa9ebdd5ae
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Wed Jul 15 18:13:58 2020
Add LazyItemScope for itemContent param of Lazy lists
Modifier.fillMaxSize() can't work inside the scrolling layout like LazyColumn/Row as the items are measured with Constraints.Infinity as the constraints for the main axis. The new scope provides new Modifier.fillParentMaxSize() and similar methods for width and height to allow to support the use case when the item should fill the viewport.
Modifier.fillMaxSize() and similar are also added into the scope just to shadow the real methods and they are marked as deprecated. So once the users will try to use them the deprecated replace-to mechanism will guide them to use correct modifiers.
We didn't just use Modifier.fillMaxSize() as this could be too magical and the intended behaviour could be lost when you slightly refactor the code and are not within the scope anymore
Fixes: 162248854
Relnote: LazyItemScope was added for itemContent param of Lazy lists. It provides modifiers to fill the parent max size which solves the use case when the item should fill the viewport and the regular Modifier.fillMaxSize() doesn't work as the item is measured with infinity constraints.
Test: new tests, new demo for manual testing
Change-Id: Ibd3b21685641c22f7deaab1bb71785d8d6135058
M ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/compose/ui/demos/gestures/PointerInputDuringSubCompDemo.kt
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/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt
M ui/ui-foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnForTest.kt
M ui/ui-foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyForIndexedTest.kt
M ui/ui-foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyRowForTest.kt
M ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyFor.kt
M ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyForState.kt
A ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyItemScope.kt
https://android-review.googlesource.com/1314601
Branch: androidx-master-dev
commit 93f2a80d7b4c7b3f80f0726f082e36fa9ebdd5ae
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Wed Jul 15 18:13:58 2020
Add LazyItemScope for itemContent param of Lazy lists
Modifier.fillMaxSize() can't work inside the scrolling layout like LazyColumn/Row as the items are measured with Constraints.Infinity as the constraints for the main axis. The new scope provides new Modifier.fillParentMaxSize() and similar methods for width and height to allow to support the use case when the item should fill the viewport.
Modifier.fillMaxSize() and similar are also added into the scope just to shadow the real methods and they are marked as deprecated. So once the users will try to use them the deprecated replace-to mechanism will guide them to use correct modifiers.
We didn't just use Modifier.fillMaxSize() as this could be too magical and the intended behaviour could be lost when you slightly refactor the code and are not within the scope anymore
Fixes: 162248854
Relnote: LazyItemScope was added for itemContent param of Lazy lists. It provides modifiers to fill the parent max size which solves the use case when the item should fill the viewport and the regular Modifier.fillMaxSize() doesn't work as the item is measured with infinity constraints.
Test: new tests, new demo for manual testing
Change-Id: Ibd3b21685641c22f7deaab1bb71785d8d6135058
M ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/compose/ui/demos/gestures/PointerInputDuringSubCompDemo.kt
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/integration-tests/foundation-demos/src/main/java/androidx/compose/foundation/demos/ListDemos.kt
M ui/ui-foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyColumnForTest.kt
M ui/ui-foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyForIndexedTest.kt
M ui/ui-foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyRowForTest.kt
M ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyFor.kt
M ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyForState.kt
A ui/ui-foundation/src/commonMain/kotlin/androidx/compose/foundation/lazy/LazyItemScope.kt
mk...@gmail.com <mk...@gmail.com> #3
is there any solutions for viewport to show just one item in each scrolling in lazycolumn ?
because after fillParentMaxHeight method the size of parent will have to be assigned in dp otherwise it ruin the size!
because after fillParentMaxHeight method the size of parent will have to be assigned in dp otherwise it ruin the size!
Description