Don't wrap tab pills

It may sometimes overlap the text a bit, but it's less awkward than wrapped pills
This commit is contained in:
arkon 2022-10-09 11:51:32 -04:00
parent d0950cb026
commit b84a31ba92

View file

@ -1,6 +1,8 @@
package eu.kanade.presentation.components package eu.kanade.presentation.components
import androidx.compose.foundation.layout.IntrinsicSize
import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.requiredWidth
import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.LocalTextStyle import androidx.compose.material3.LocalTextStyle
import androidx.compose.material3.MaterialTheme import androidx.compose.material3.MaterialTheme
@ -8,6 +10,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.unit.Dp import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.TextUnit import androidx.compose.ui.unit.TextUnit
import androidx.compose.ui.unit.dp import androidx.compose.ui.unit.dp
@ -16,13 +19,14 @@ import androidx.compose.ui.unit.dp
fun Pill( fun Pill(
text: String, text: String,
modifier: Modifier = Modifier, modifier: Modifier = Modifier,
color: androidx.compose.ui.graphics.Color = MaterialTheme.colorScheme.background, color: Color = MaterialTheme.colorScheme.background,
contentColor: androidx.compose.ui.graphics.Color = MaterialTheme.colorScheme.onBackground, contentColor: Color = MaterialTheme.colorScheme.onBackground,
elevation: Dp = 1.dp, elevation: Dp = 1.dp,
fontSize: TextUnit = LocalTextStyle.current.fontSize, fontSize: TextUnit = LocalTextStyle.current.fontSize,
) { ) {
androidx.compose.material3.Surface( androidx.compose.material3.Surface(
modifier = modifier modifier = modifier
.requiredWidth(IntrinsicSize.Max)
.padding(start = 4.dp) .padding(start = 4.dp)
.clip(RoundedCornerShape(100)), .clip(RoundedCornerShape(100)),
color = color, color = color,
@ -33,6 +37,8 @@ fun Pill(
text = text, text = text,
modifier = Modifier.padding(6.dp, 1.dp), modifier = Modifier.padding(6.dp, 1.dp),
fontSize = fontSize, fontSize = fontSize,
maxLines = 1,
softWrap = false,
) )
} }
} }