mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-16 17:49:17 +01:00
Center the Text inside Pill
(#8304)
This commit is contained in:
parent
c50b1a5c66
commit
37c55abc2a
@ -1,5 +1,6 @@
|
|||||||
package eu.kanade.presentation.components
|
package eu.kanade.presentation.components
|
||||||
|
|
||||||
|
import androidx.compose.foundation.layout.Box
|
||||||
import androidx.compose.foundation.layout.IntrinsicSize
|
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.layout.requiredWidth
|
||||||
@ -8,8 +9,8 @@ import androidx.compose.material3.LocalTextStyle
|
|||||||
import androidx.compose.material3.MaterialTheme
|
import androidx.compose.material3.MaterialTheme
|
||||||
import androidx.compose.material3.Text
|
import androidx.compose.material3.Text
|
||||||
import androidx.compose.runtime.Composable
|
import androidx.compose.runtime.Composable
|
||||||
|
import androidx.compose.ui.Alignment
|
||||||
import androidx.compose.ui.Modifier
|
import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.draw.clip
|
|
||||||
import androidx.compose.ui.graphics.Color
|
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
|
||||||
@ -26,19 +27,24 @@ fun Pill(
|
|||||||
) {
|
) {
|
||||||
androidx.compose.material3.Surface(
|
androidx.compose.material3.Surface(
|
||||||
modifier = modifier
|
modifier = modifier
|
||||||
.requiredWidth(IntrinsicSize.Max)
|
.padding(start = 4.dp),
|
||||||
.padding(start = 4.dp)
|
shape = RoundedCornerShape(100),
|
||||||
.clip(RoundedCornerShape(100)),
|
|
||||||
color = color,
|
color = color,
|
||||||
contentColor = contentColor,
|
contentColor = contentColor,
|
||||||
tonalElevation = elevation,
|
tonalElevation = elevation,
|
||||||
|
) {
|
||||||
|
Box(
|
||||||
|
modifier = Modifier
|
||||||
|
.requiredWidth(IntrinsicSize.Max)
|
||||||
|
.padding(6.dp, 1.dp),
|
||||||
|
contentAlignment = Alignment.Center,
|
||||||
) {
|
) {
|
||||||
Text(
|
Text(
|
||||||
text = text,
|
text = text,
|
||||||
modifier = Modifier.padding(6.dp, 1.dp),
|
|
||||||
fontSize = fontSize,
|
fontSize = fontSize,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
softWrap = false,
|
softWrap = false,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user