Reputation: 31
I'm learning Compose and I just wanted to style my item for my LazyColumn. However when I'm adding the first argument it seems to always reject it. Even when I delete the padding, the next argument will be in err.
Can anyone see something I'm missing because I've been looking at this for an hour.
@Composable
fun NewsArticleItem(news: News) {
Row {
Column(
modifier = Modifier
.padding(16.dp)
.background(Color.Green)
.fillMaxWidth()
.align(Alignment.CenterVertically)
) {
Text(text = news.title, style = typography.h5)
Text(text = news.body, style = typography.caption)
}
}
}
Upvotes: 1
Views: 879
Reputation: 87605
You can't pass dp
into .fillMaxWidth()
You can pass 0..1
Float
there, which will make it take part of available width, default is 1
You can specify dp
into .width(56.dp)
modifier
If this didn't help, please specify which modifier exactly doesn't work in your case? Width fixed width
modifier in my case everything seems work as expected
Upvotes: 1