I want to show the list of customer’s names in lazy column, so i created a list variable and used clicableText composables inside it, so that each item can be clicked, then i want to use it inside a lazy column to display and can be scrolled vertically, but i logic is not good here, below is my code, i just commented my practice
fun allCustomers(navController: NavController)
{
val customerLists = listOf(
ClickableText(text = AnnotatedString("Customer1"),
onClick = {}),
ClickableText(text = AnnotatedString("Customer2"),
onClick = {}),
ClickableText(text = AnnotatedString("Customer3"),
onClick = {}),
ClickableText(text = AnnotatedString("Customer4"),
onClick = {}),
ClickableText(text = AnnotatedString("Customer5"),
onClick = {}),
ClickableText(text = AnnotatedString("Customer6"),
onClick = {}),
ClickableText(text = AnnotatedString("Customer7"),
onClick = {}),
ClickableText(text = AnnotatedString("Customer8"),
onClick = {}),
ClickableText(text = AnnotatedString("Customer9"),
onClick = {}),
ClickableText(text = AnnotatedString("Customer10"),
onClick = {}),
)
LazyColumn(modifier = Modifier.fillMaxHeight(),
contentPadding = PaddingValues(5.dp)
)
{
// items(1){cus->
// customerLists
// }
items(1, itemContent = {
customerLists.forEachIndexed {
index, item ->
customerLists
// Text(text = item,
// color = Color(0xFFFCA4FF),
// fontWeight = FontWeight.Bold,
// fontSize = 24.sp,
// lineHeight = 120.sp)
}
} )
}}
i tried to show a list of customers, but
Text(text = item,
color = Color(0xFFFCA4FF),
fontWeight = FontWeight.Bold,
fontSize = 24.sp,
lineHeight = 120.sp)
above code is not accepted inside lazy column
Soonha Soomro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.