Karthick
@Composable fun Body() { val lazyListState = rememberLazyListState() LazyColumn(state = lazyListState) { .... } val jumpThreshold = with(LocalDensity.current) { 56.dp.toPx() } val showScrollToTopButton = remember { derivedStateOf { lazyListState.firstVisibleItemIndex != 0 || lazyListState.firstVisibleItemScrollOffset > jumpThreshold } } ScrollToTop(enabled = showScrollToTopButton.value) } @Composable fun ScrollToTop(enabled: Boolean){....}
@Composable fun Body() { val lazyListState = rememberLazyListState() LazyColumn(state = lazyListState) { .... } val jumpThreshold = with(LocalDensity.current) { 56.dp.toPx() } val showScrollToTopButton = remember { derivedStateOf { lazyListState.firstVisibleItemIndex != 0 || lazyListState.firstVisibleItemScrollOffset > jumpThreshold } } ScrollToTop(enabled = showScrollToTopButton) } @Composable fun ScrollToTop(enabled: State<Boolean>){....}
showScrollToTopButton
Body
State<Boolean>
Boolean
brandonmcansh
FunkyMuse
A modern programming language that makes developers happier.