refactor: Improve device details layout (#1489)

- Device details section visible only if device hardware is available.
- Added spacing between icon, label, and value in node details rows.
- Right-aligned the values in node details rows for better readability.
pull/1500/head^2
James Rich 2024-12-22 03:56:40 -06:00 zatwierdzone przez GitHub
rodzic 5854f91b7a
commit 43561cabe9
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
1 zmienionych plików z 8 dodań i 6 usunięć

Wyświetl plik

@ -140,9 +140,11 @@ private fun NodeDetailList(
modifier = modifier.fillMaxSize(),
contentPadding = PaddingValues(horizontal = 16.dp),
) {
item {
PreferenceCategory("Device") {
DeviceDetailsContent(metricsState)
if (metricsState.deviceHardware != null) {
item {
PreferenceCategory("Device") {
DeviceDetailsContent(metricsState)
}
}
}
item {
@ -198,7 +200,8 @@ private fun NodeDetailRow(
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 8.dp),
verticalAlignment = Alignment.CenterVertically
verticalAlignment = Alignment.CenterVertically,
horizontalArrangement = Arrangement.spacedBy(8.dp)
) {
Icon(
imageVector = icon,
@ -206,10 +209,9 @@ private fun NodeDetailRow(
modifier = Modifier.size(24.dp),
tint = iconTint
)
Spacer(modifier = Modifier.width(8.dp))
Text(label)
Spacer(modifier = Modifier.weight(1f))
Text(value)
Text(textAlign = TextAlign.End, text = value)
}
}