简体   繁体   English

Compose material3 OverScroll 4个方向显示

[英]Compose material3 OverScroll Shows in all 4 directions

I am using meterial3 with Compose.我正在将meterial3与Compose一起使用。 I found that all the Scrollable Composable Showing overscroll effect in all 4 directions regardless of scrolling direction.我发现所有 Scrollable Composable Showing overscroll 效果在所有 4 个方向上,无论滚动方向如何。 that goes for Column , LazyColumn , LazyVerticalGrid etc..这适用于ColumnLazyColumnLazyVerticalGrid等。

I m not using anything custom to override overscroll effect.我没有使用任何自定义来覆盖过度滚动效果。 i can not figure out whats causing this behavior.我无法弄清楚是什么导致了这种行为。 i will add an example code below with LazyVerticalGrid which is causing this behavior.我将在下面添加导致此行为的LazyVerticalGrid示例代码。 Since this is vertical grid it should show over scroll only vertically(to and bottom) but it also show it horizontally (left and right)..由于这是垂直网格,它应该只显示垂直滚动(到和底部),但它也水平显示(左和右)..

Any direction on this will be appreciated.对此的任何指导将不胜感激。

@Composable
@Destination
fun FavoritesScreen(navigator: DestinationsNavigator) {
val favoritesViewModel: FavoritesViewModel = hiltViewModel()
val favoritesLiveData =
    favoritesViewModel.favoritesLiveData.observeAsState(initial = null)
if (favoritesLiveData.value != null) {
    if (favoritesLiveData.value!!.isEmpty()) {
      // Show empty view
    } else {
        LazyVerticalGrid(
            contentPadding = PaddingValues(
                12.dp,
                12.dp,
                12.dp,
                20.dp
            ),
            columns = GridCells.Fixed(2),
            horizontalArrangement = Arrangement.spacedBy(12.dp),
            verticalArrangement = Arrangement.spacedBy(12.dp),
        ) {
            item(span = { GridItemSpan(2) }) {
                Spacer(modifier = Modifier.windowInsetsTopHeight(WindowInsets.statusBars))
                Text(
                    text = stringResource(id = R.string.favorites),
                    style = MaterialTheme.typography.headlineMedium,
                    modifier = Modifier.padding(top = 20.dp)
                )
                ColumnSpacer(value = 10)
            }
            items(favoritesLiveData.value!!) { game ->
                // grid Item
            }
        }
    }
} 
}

You may need to update your Compose version.您可能需要更新 Compose 版本。 This was a known issue in Compose 1.3.0-alpha01, which was fixed subsequently.这是 Compose 1.3.0-alpha01 中的一个已知问题,随后已修复。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM