Not Sure this one can help you. Please take a look. IntrinsicSize.Max can cause unintended behavior in layout calculation, especially with the combination of fillMaxHeight().
@Composable
fun WeatherCardWithTopBar(title: String, text: String, icon: ImageVector) {
Card(
modifier = Modifier.padding(8.dp) // External padding to adjust card spacing
) {
Row(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp), // Internal padding for Row
) {
// Left side column with background and centered content
Column(
modifier = Modifier
.fillMaxWidth(0.20f)
.background(MaterialTheme.colorScheme.secondary)
.padding(8.dp),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center, // Center content vertically
) {
Icon(
imageVector = icon,
modifier = Modifier.size(48.dp),
contentDescription = "Weather",
tint = MaterialTheme.colorScheme.onSecondary,
)
Text(
text = title,
modifier = Modifier.padding(top = 8.dp), // Adjusted padding for text
style = MaterialTheme.typography.titleLarge,
color = MaterialTheme.colorScheme.onSecondary,
)
}
// Right side column for additional text
Column(
modifier = Modifier
.weight(1f) // Fills the remaining width of the Row
.padding(start = 16.dp) // Padding between columns
) {
Text(
text = text,
style = MaterialTheme.typography.bodyMedium,
)
}
}
}
}