Lazy List Scrollbar Host
fun LazyListScrollbarHost(modifier: Modifier = Modifier, lazyListState: LazyListState = rememberLazyListState(), content: @Composable (LazyListState) -> Unit)
This Host contains LazyListScrollbarScreen and content. It overlay scrollbar over the lazy composable content. It took over the lazyListState at content for sharing lazyListState.
Parameters
lazy List State
LazyListState for sharing state with content and LazyListScrollbarScreen both.
content
This will be lazy composable: LazyColumn or LazyRow.
modifier
Modify LazyListScrollbarHost.
Samples
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import starlightlab.jaehwa.lazyscrollsdk.ui.LazyListScrollbarHost
fun main() {
//sampleStart
LazyListScrollbarHost { lazyListState ->
LazyColumn(state = lazyListState) {
repeat(100) {
item {
Text(
"Hello, $it",
modifier = Modifier.padding(16.dp),
)
}
}
}
}
//sampleEnd
}
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.LazyRow
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import starlightlab.jaehwa.lazyscrollsdk.ui.LazyListScrollbarHost
fun main() {
//sampleStart
LazyListScrollbarHost { lazyListState ->
LazyRow(state = lazyListState) {
repeat(100) {
item {
Text(
"Hello, $it",
modifier = Modifier.padding(16.dp),
)
}
}
}
}
//sampleEnd
}