package com.suno.android.common_ui.components.indicators import androidx.compose.foundation.background import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.width import androidx.compose.foundation.lazy.LazyListState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.dp @Composable fun VerticalScrollbar( modifier: Modifier = Modifier, scrollState: LazyListState, ) { val totalItems = scrollState.layoutInfo.totalItemsCount val visibleItems = scrollState.layoutInfo.visibleItemsInfo.size val isScrollingNeeded = totalItems > visibleItems if (isScrollingNeeded) { val firstVisibleItemIndex = scrollState.firstVisibleItemIndex val firstVisibleItemScrollOffset = scrollState.firstVisibleItemScrollOffset val progress = (firstVisibleItemIndex + firstVisibleItemScrollOffset / 1000f) / totalItems.toFloat() Box( modifier = modifier .padding(horizontal = 4.dp) .background(Color.Gray.copy(alpha = 0.5f), shape = RoundedCornerShape(12.dp)) .width(8.dp), ) { Box( modifier = Modifier .fillMaxWidth() .height((progress * 100).dp) .background(Color.Blue, shape = RoundedCornerShape(12.dp)), ) } } }