SEARCH (GET A FREE ACCOUNT HERE)
@Composable
fun Search (
modifier: Modifier = Modifier,
searchBoxState: SearchBoxState,
paginator: Paginator
)
{
val scope = rememberCoroutineScope()
val pagingHits = paginator.flow.collectAsLazyPagingItems()
val listState = rememberLazyListState()
Column(modifier) {
SearchBox(
modifier = Modifier
.weight(1f)
.padding(top = 12.dp, start = 12.dp),
searchBoxState = searchBoxState,
onValueChange = { _, _ -> scope.launch { listState.scrollToItem(0) } },
)
ProductsList(
modifier = Modifier.fillMaxSize(),
pagingHits = pagingHits,
listState = listState,
)
}
}