UI: fix the layout issue on large font sizes
This commit is contained in:
parent
930e707608
commit
8f90e42ee2
|
|
@ -308,7 +308,7 @@ fun ModelCardContentArchitectureRow(model: ModelInfo) =
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
fun ModelCardContentDatesRow(model: ModelInfo) {
|
fun ModelCardContentDatesRow(model: ModelInfo) {
|
||||||
val dateFormatter = remember { SimpleDateFormat("MMM d, yyyy", Locale.getDefault()) }
|
val dateFormatter = remember { SimpleDateFormat("MMM d", Locale.getDefault()) }
|
||||||
|
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
|
|
|
||||||
|
|
@ -537,31 +537,48 @@ fun HuggingFaceModelListItem(
|
||||||
modifier = Modifier.fillMaxWidth(),
|
modifier = Modifier.fillMaxWidth(),
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
Column(modifier = Modifier.weight(0.9f)) {
|
Column(modifier = Modifier.fillMaxWidth(0.85f)) {
|
||||||
Row(
|
Row(modifier = Modifier.fillMaxWidth().padding(bottom = 8.dp)) {
|
||||||
modifier = Modifier.padding(bottom = 8.dp),
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
verticalAlignment = Alignment.CenterVertically
|
Icon(
|
||||||
) {
|
imageVector = Icons.Default.Attribution,
|
||||||
Icon(
|
contentDescription = "Author",
|
||||||
imageVector = Icons.Default.Attribution,
|
modifier = Modifier.size(16.dp),
|
||||||
contentDescription = "Author",
|
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
modifier = Modifier.size(16.dp),
|
)
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
|
||||||
|
|
||||||
Text(
|
Text(
|
||||||
modifier = Modifier.padding(start = 4.dp),
|
modifier = Modifier.padding(start = 4.dp),
|
||||||
text = model.author,
|
text = model.author,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
|
|
||||||
|
Row(
|
||||||
|
modifier = Modifier.padding(start = 6.dp),
|
||||||
|
verticalAlignment = Alignment.CenterVertically
|
||||||
|
) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Default.Favorite,
|
||||||
|
contentDescription = "Favorite count",
|
||||||
|
modifier = Modifier.size(16.dp),
|
||||||
|
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
|
||||||
|
Text(
|
||||||
|
modifier = Modifier.padding(start = 4.dp),
|
||||||
|
text = formatContextLength(model.likes),
|
||||||
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
|
color = MaterialTheme.colorScheme.onSurfaceVariant
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Row(
|
Row(modifier = Modifier.fillMaxWidth()) {
|
||||||
modifier = Modifier.fillMaxWidth(),
|
Row(verticalAlignment = Alignment.CenterVertically) {
|
||||||
verticalAlignment = Alignment.CenterVertically
|
|
||||||
) {
|
|
||||||
Row(modifier = Modifier.weight(5f).padding(end = 8.dp)) {
|
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.Today,
|
imageVector = Icons.Default.Today,
|
||||||
contentDescription = "Author",
|
contentDescription = "Author",
|
||||||
|
|
@ -577,23 +594,12 @@ fun HuggingFaceModelListItem(
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
Row(modifier = Modifier.weight(3f).padding(end = 8.dp)) {
|
Spacer(modifier = Modifier.weight(1f))
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Default.Favorite,
|
|
||||||
contentDescription = "Favorite count",
|
|
||||||
modifier = Modifier.size(16.dp),
|
|
||||||
tint = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
|
||||||
|
|
||||||
Text(
|
Row(
|
||||||
modifier = Modifier.padding(start = 4.dp),
|
modifier = Modifier.padding(start = 6.dp),
|
||||||
text = formatContextLength(model.likes),
|
verticalAlignment = Alignment.CenterVertically
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
) {
|
||||||
color = MaterialTheme.colorScheme.onSurfaceVariant
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
Row(modifier = Modifier.weight(4f).padding(end = 4.dp)) {
|
|
||||||
Icon(
|
Icon(
|
||||||
imageVector = Icons.Default.Download,
|
imageVector = Icons.Default.Download,
|
||||||
contentDescription = "Download count",
|
contentDescription = "Download count",
|
||||||
|
|
@ -611,11 +617,14 @@ fun HuggingFaceModelListItem(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Checkbox(
|
Box(modifier = Modifier.fillMaxSize()) {
|
||||||
modifier = Modifier.size(32.dp).alpha(if (isSelected) 1f else 0f),
|
Checkbox(
|
||||||
checked = isSelected,
|
modifier = Modifier.align(Alignment.Center).size(32.dp)
|
||||||
onCheckedChange = null, // handled by parent selectable
|
.alpha(if (isSelected) 1f else 0f),
|
||||||
)
|
checked = isSelected,
|
||||||
|
onCheckedChange = null, // handled by parent selectable
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue