@@ -11,6 +11,8 @@ import androidx.compose.animation.fadeIn
1111import androidx.compose.animation.fadeOut
1212import androidx.compose.animation.shrinkVertically
1313import androidx.compose.foundation.layout.*
14+ import androidx.compose.foundation.clickable
15+ import androidx.compose.foundation.horizontalScroll
1416import androidx.compose.foundation.lazy.LazyColumn
1517import androidx.compose.foundation.lazy.items
1618import androidx.compose.foundation.rememberScrollState
@@ -311,8 +313,12 @@ fun ModelSection(
311313 contentDescription = null ,
312314 modifier = Modifier .size(18 .dp)
313315 )
314- Spacer (modifier = Modifier .width(6 .dp))
315- Text (stringResource(R .string.hf_model_picker))
316+ Spacer (modifier = Modifier .width(4 .dp))
317+ Text (
318+ text = stringResource(R .string.hf_model_picker),
319+ maxLines = 1 ,
320+ overflow = TextOverflow .Clip
321+ )
316322 }
317323 Row (verticalAlignment = Alignment .CenterVertically ) {
318324 TextButton (onClick = onManageModels) {
@@ -321,17 +327,25 @@ fun ModelSection(
321327 contentDescription = null ,
322328 modifier = Modifier .size(18 .dp)
323329 )
324- Spacer (modifier = Modifier .width(6 .dp))
325- Text (stringResource(R .string.manage_models))
330+ Spacer (modifier = Modifier .width(4 .dp))
331+ Text (
332+ text = stringResource(R .string.manage_models),
333+ maxLines = 1 ,
334+ overflow = TextOverflow .Clip
335+ )
326336 }
327337 TextButton (onClick = onBrowseClick) {
328338 Icon (
329339 Icons .Default .Folder ,
330340 contentDescription = null ,
331341 modifier = Modifier .size(18 .dp)
332342 )
333- Spacer (modifier = Modifier .width(6 .dp))
334- Text (stringResource(R .string.browse))
343+ Spacer (modifier = Modifier .width(4 .dp))
344+ Text (
345+ text = stringResource(R .string.browse_model),
346+ maxLines = 1 ,
347+ overflow = TextOverflow .Clip
348+ )
335349 }
336350 }
337351 }
@@ -865,24 +879,15 @@ private fun HuggingFaceModelPickerDialog(
865879 ) {
866880 if (state.selectedRepoId == null ) {
867881 items(state.searchResults) { repo ->
868- ListItem (
869- headlineContent = {
870- Text (repo.modelId, maxLines = 1 , overflow = TextOverflow .Ellipsis )
871- },
872- supportingContent = {
873- Text (
874- stringResource(
875- R .string.hf_model_stats,
876- repo.downloads ? : 0 ,
877- repo.likes ? : 0
878- )
879- )
880- },
881- trailingContent = {
882- TextButton (onClick = { onRepoSelect(repo.modelId) }) {
883- Text (stringResource(R .string.select))
884- }
885- }
882+ HfPickerCard (
883+ title = repo.modelId,
884+ subtitle = stringResource(
885+ R .string.hf_model_stats,
886+ repo.downloads ? : 0 ,
887+ repo.likes ? : 0
888+ ),
889+ enabled = state.downloadFileName == null ,
890+ onClick = { onRepoSelect(repo.modelId) }
886891 )
887892 }
888893 } else {
@@ -892,21 +897,11 @@ private fun HuggingFaceModelPickerDialog(
892897 }
893898 }
894899 items(state.files) { file ->
895- ListItem (
896- headlineContent = {
897- Text (file.fileName, maxLines = 1 , overflow = TextOverflow .Ellipsis )
898- },
899- supportingContent = {
900- Text (file.sizeBytes?.let { formatBytes(it) } ? : stringResource(R .string.unknown_size))
901- },
902- trailingContent = {
903- TextButton (
904- onClick = { onDownload(file) },
905- enabled = state.downloadFileName == null
906- ) {
907- Text (stringResource(R .string.download))
908- }
909- }
900+ HfPickerCard (
901+ title = file.fileName,
902+ subtitle = file.sizeBytes?.let { formatBytes(it) },
903+ enabled = state.downloadFileName == null ,
904+ onClick = { onDownload(file) }
910905 )
911906 }
912907 }
@@ -930,6 +925,47 @@ private fun HuggingFaceModelPickerDialog(
930925 )
931926}
932927
928+ @Composable
929+ private fun HfPickerCard (
930+ title : String ,
931+ subtitle : String? ,
932+ enabled : Boolean ,
933+ onClick : () -> Unit
934+ ) {
935+ Surface (
936+ modifier = Modifier
937+ .fillMaxWidth()
938+ .clickable(enabled = enabled, onClick = onClick),
939+ shape = RoundedCornerShape (12 .dp),
940+ color = MaterialTheme .colorScheme.surfaceVariant.copy(alpha = 0.72f )
941+ ) {
942+ Column (
943+ modifier = Modifier .padding(horizontal = 16 .dp, vertical = 14 .dp),
944+ verticalArrangement = Arrangement .spacedBy(6 .dp)
945+ ) {
946+ Text (
947+ text = title,
948+ modifier = Modifier
949+ .fillMaxWidth()
950+ .horizontalScroll(rememberScrollState()),
951+ maxLines = 1 ,
952+ softWrap = false ,
953+ style = MaterialTheme .typography.titleMedium,
954+ fontWeight = FontWeight .SemiBold
955+ )
956+ subtitle?.let {
957+ Text (
958+ text = it,
959+ maxLines = 1 ,
960+ overflow = TextOverflow .Ellipsis ,
961+ style = MaterialTheme .typography.bodyMedium,
962+ color = MaterialTheme .colorScheme.onSurfaceVariant
963+ )
964+ }
965+ }
966+ }
967+ }
968+
933969@Composable
934970fun ConfigSectionCard (
935971 title : String ,
0 commit comments