From b84a31ba9259ae1cd903bcec4f6339fc88d44831 Mon Sep 17 00:00:00 2001 From: arkon Date: Sun, 9 Oct 2022 11:51:32 -0400 Subject: [PATCH] Don't wrap tab pills It may sometimes overlap the text a bit, but it's less awkward than wrapped pills --- .../java/eu/kanade/presentation/components/Pill.kt | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/components/Pill.kt b/app/src/main/java/eu/kanade/presentation/components/Pill.kt index 2cbcdee29..ce8d9c55c 100644 --- a/app/src/main/java/eu/kanade/presentation/components/Pill.kt +++ b/app/src/main/java/eu/kanade/presentation/components/Pill.kt @@ -1,6 +1,8 @@ package eu.kanade.presentation.components +import androidx.compose.foundation.layout.IntrinsicSize import androidx.compose.foundation.layout.padding +import androidx.compose.foundation.layout.requiredWidth import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.MaterialTheme @@ -8,6 +10,7 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.draw.clip +import androidx.compose.ui.graphics.Color import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.dp @@ -16,13 +19,14 @@ import androidx.compose.ui.unit.dp fun Pill( text: String, modifier: Modifier = Modifier, - color: androidx.compose.ui.graphics.Color = MaterialTheme.colorScheme.background, - contentColor: androidx.compose.ui.graphics.Color = MaterialTheme.colorScheme.onBackground, + color: Color = MaterialTheme.colorScheme.background, + contentColor: Color = MaterialTheme.colorScheme.onBackground, elevation: Dp = 1.dp, fontSize: TextUnit = LocalTextStyle.current.fontSize, ) { androidx.compose.material3.Surface( modifier = modifier + .requiredWidth(IntrinsicSize.Max) .padding(start = 4.dp) .clip(RoundedCornerShape(100)), color = color, @@ -33,6 +37,8 @@ fun Pill( text = text, modifier = Modifier.padding(6.dp, 1.dp), fontSize = fontSize, + maxLines = 1, + softWrap = false, ) } }