mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Update: Revamp Repos' layout
This commit is contained in:
parent
f786b73481
commit
79d3eb78b0
@ -15,6 +15,7 @@ import androidx.compose.material3.Icon
|
|||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Surface
|
import androidx.compose.material3.Surface
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
|
import androidx.compose.material3.surfaceColorAtElevation
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
import androidx.compose.runtime.getValue
|
import androidx.compose.runtime.getValue
|
||||||
import androidx.compose.runtime.mutableStateOf
|
import androidx.compose.runtime.mutableStateOf
|
||||||
@ -38,7 +39,7 @@ fun RepositoryItem(
|
|||||||
mutableStateOf(repository.enabled)
|
mutableStateOf(repository.enabled)
|
||||||
}
|
}
|
||||||
val backgroundColor by animateColorAsState(
|
val backgroundColor by animateColorAsState(
|
||||||
targetValue = if (isEnabled) MaterialTheme.colorScheme.primaryContainer
|
targetValue = if (isEnabled) MaterialTheme.colorScheme.surfaceColorAtElevation(32.dp)
|
||||||
else MaterialTheme.colorScheme.background
|
else MaterialTheme.colorScheme.background
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -55,7 +56,7 @@ fun RepositoryItem(
|
|||||||
onLongClick = { onLongClick(repository) }
|
onLongClick = { onLongClick(repository) }
|
||||||
),
|
),
|
||||||
color = backgroundColor,
|
color = backgroundColor,
|
||||||
shape = MaterialTheme.shapes.extraLarge
|
shape = MaterialTheme.shapes.large
|
||||||
) {
|
) {
|
||||||
Row(
|
Row(
|
||||||
modifier = Modifier.padding(
|
modifier = Modifier.padding(
|
||||||
@ -65,37 +66,20 @@ fun RepositoryItem(
|
|||||||
horizontalArrangement = Arrangement.SpaceBetween,
|
horizontalArrangement = Arrangement.SpaceBetween,
|
||||||
verticalAlignment = Alignment.CenterVertically
|
verticalAlignment = Alignment.CenterVertically
|
||||||
) {
|
) {
|
||||||
RepositoryItemText(
|
|
||||||
repositoryName = repository.name,
|
|
||||||
repositoryDescription = repository.description
|
|
||||||
)
|
|
||||||
AnimatedVisibility(visible = isEnabled) {
|
|
||||||
Icon(
|
|
||||||
imageVector = Icons.Default.Done,
|
|
||||||
contentDescription = "Repository Enabled"
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Composable
|
|
||||||
private fun RepositoryItemText(
|
|
||||||
modifier: Modifier = Modifier,
|
|
||||||
repositoryName: String,
|
|
||||||
repositoryDescription: String?
|
|
||||||
) {
|
|
||||||
Column(
|
Column(
|
||||||
modifier = modifier.fillMaxWidth(0.9f),
|
modifier = modifier.fillMaxWidth(0.9f),
|
||||||
horizontalAlignment = Alignment.Start,
|
horizontalAlignment = Alignment.Start,
|
||||||
verticalArrangement = Arrangement.spacedBy(8.dp)
|
verticalArrangement = Arrangement.spacedBy(8.dp)
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = repositoryName.trim(),
|
text = repository.name.trim(),
|
||||||
style = MaterialTheme.typography.titleMedium,
|
style = MaterialTheme.typography.titleMedium,
|
||||||
|
color = if (isEnabled) MaterialTheme.colorScheme.onPrimaryContainer
|
||||||
|
else MaterialTheme.colorScheme.onSurface,
|
||||||
maxLines = 1
|
maxLines = 1
|
||||||
)
|
)
|
||||||
repositoryDescription?.trim()?.let {
|
repository.description.trim().let {
|
||||||
Text(
|
Text(
|
||||||
text = it,
|
text = it,
|
||||||
style = MaterialTheme.typography.bodyMedium,
|
style = MaterialTheme.typography.bodyMedium,
|
||||||
@ -105,4 +89,13 @@ private fun RepositoryItemText(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
AnimatedVisibility(visible = isEnabled) {
|
||||||
|
Icon(
|
||||||
|
imageVector = Icons.Default.Done,
|
||||||
|
tint = MaterialTheme.colorScheme.primary,
|
||||||
|
contentDescription = "Repository Enabled"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user