ui: separate info labels from their values

This commit is contained in:
austinried
2026-10-20 14:58:52 +00:00
parent c56a6d4f83
commit fbd4c0c4fe
2 changed files with 9 additions and 1 deletions
@@ -5,6 +5,7 @@ import android.text.format.DateUtils
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
@@ -101,6 +102,7 @@ internal fun InfoRow(
color = MaterialTheme.colorScheme.primary,
modifier = Modifier.width(INFO_LABEL_WIDTH),
)
Spacer(Modifier.width(INFO_LABEL_GAP))
Text(
text = value,
style = MaterialTheme.typography.bodyMedium,
@@ -126,4 +128,5 @@ private fun formatDate(
DateUtils.FORMAT_SHOW_DATE or DateUtils.FORMAT_SHOW_YEAR,
)
private val INFO_LABEL_WIDTH = 96.dp
private val INFO_LABEL_WIDTH = 100.dp
private val INFO_LABEL_GAP = 12.dp
@@ -9,6 +9,7 @@ import com.subtracks.data.model.Album
import com.subtracks.data.model.Artist
import com.subtracks.data.model.ArtistRef
import com.subtracks.ui.theme.SubtracksTheme
import org.junit.Assert.assertTrue
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith
@@ -52,6 +53,10 @@ class LibraryInfoDialogTest {
composeRule.onNodeWithText("Album, The").assertIsDisplayed()
composeRule.onNodeWithText("A, The").assertIsDisplayed()
composeRule.onNodeWithText("1999").assertIsDisplayed()
val label = composeRule.onNodeWithText("Album artist sort").fetchSemanticsNode().boundsInRoot
val value = composeRule.onNodeWithText("A, The").fetchSemanticsNode().boundsInRoot
assertTrue("the value must be separated from its label", value.left > label.right)
}
@Test