[go: nahoru, domu]

Deprecate Scroller. Introduce ScrollableColumn / ScrollableRow

This CL reworks Scrolling-related API. Scrollers and ScrollerPosition have been deprecated. Instead, ScrollableColumn, ScrollableRow and ScrollState have been introduced. Additionaly, for more flexibility and performance, Modifier.verticalScroll and Modifier.horizontalScroll have been introduced, so users can add scrolling to everything while saving layout node.

While moving from ScrollerPosition to ScrollState, few API were renamed and simplified and @Composable ScrollerPosition was replaced with rememberScrollState.

Relnote: 'VerticalScroller and HoriziontalScroller have been deprecated. Use ScrollableColumn and ScrollableRow for build-in experience with Column/Row behaviour and parameters, or Modifier.verticalScroll and Modifier.horizontalScroll on your own element. Similarly, ScrollerPosition has been deprecated in favor of ScrollState'
Fixes: 158571223
Fixes: 157225838
Bug: 148542949
Bug: 150706555
Fixes: 150458415
Fixes: 149460415
Fixes: 154105299
Test: Tests were fixed for new APIs
Change-Id: I400ce0e6c0e33aa865e0e49defef1eb92ac40a93
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/IsDisplayedTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/IsDisplayedTest.kt
index 67ae035..03670aa 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/IsDisplayedTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/IsDisplayedTest.kt
@@ -37,7 +37,7 @@
 import androidx.ui.core.Modifier
 import androidx.ui.core.setContent
 import androidx.ui.foundation.Box
-import androidx.ui.foundation.VerticalScroller
+import androidx.ui.foundation.ScrollableColumn
 import androidx.ui.graphics.Color
 import androidx.ui.layout.Row
 import androidx.ui.layout.Stack
@@ -108,7 +108,7 @@
     @Test
     fun componentInScrollable_isDisplayed() {
         composeTestRule.setContent {
-            VerticalScroller(modifier = Modifier.size(100.dp)) {
+            ScrollableColumn(modifier = Modifier.size(100.dp)) {
                 repeat(10) { Item(it, height = 30.dp) }
             }
         }
@@ -120,7 +120,7 @@
     @Test
     fun componentInScrollable_isNotDisplayed() {
         composeTestRule.setContent {
-            VerticalScroller(modifier = Modifier.size(100.dp)) {
+            ScrollableColumn(modifier = Modifier.size(100.dp)) {
                 repeat(10) { Item(it, height = 30.dp) }
             }
         }