diff --git a/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/attributespage/Talent.kt b/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/attributespage/Talent.kt index 1bf5a67..3e090ea 100644 --- a/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/attributespage/Talent.kt +++ b/sharedUI/src/commonMain/kotlin/org/shahondin1624/lib/components/charactermodel/attributespage/Talent.kt @@ -4,9 +4,10 @@ import androidx.compose.foundation.Image import androidx.compose.foundation.background import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Row +import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size -import androidx.compose.foundation.layout.width +import androidx.compose.foundation.layout.widthIn import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.material3.Card import androidx.compose.material3.IconButton @@ -22,6 +23,7 @@ import androidx.compose.ui.graphics.Color import androidx.compose.ui.graphics.ColorFilter import androidx.compose.ui.platform.testTag import androidx.compose.ui.text.style.TextAlign +import androidx.compose.ui.text.style.TextOverflow import androidx.compose.ui.unit.dp import org.jetbrains.compose.resources.painterResource import org.shahondin1624.lib.components.TestTags @@ -46,39 +48,50 @@ fun Talent( Card(modifier = Modifier.testTag(TestTags.talentCard(talent.name))) { Row( verticalAlignment = Alignment.CenterVertically, - horizontalArrangement = Arrangement.Start + horizontalArrangement = Arrangement.Start, + modifier = Modifier.fillMaxWidth() ) { Row( modifier = Modifier + .weight(1f) .padding(horizontal = SMALL_PADDING) .background( talent.attribute.color, shape = RoundedCornerShape(4.dp) ) - .clip(androidx.compose.foundation.shape.RoundedCornerShape(4.dp)), - horizontalArrangement = Arrangement.SpaceBetween + .clip(RoundedCornerShape(4.dp)), + horizontalArrangement = Arrangement.SpaceBetween, + verticalAlignment = Alignment.CenterVertically ) { Text( text = talent.name, modifier = Modifier - .width(150.dp) + .weight(1f) .padding(start = SMALL_PADDING), - textAlign = TextAlign.Center, - color = textColor + textAlign = TextAlign.Start, + color = textColor, + maxLines = 1, + overflow = TextOverflow.Ellipsis ) Text( text = attributes.getAttributeByType(talent.attribute).value.toString(), modifier = Modifier - .padding(end = SMALL_PADDING), - textAlign = TextAlign.Center, - color = textColor + .widthIn(min = 24.dp) + .padding(horizontal = SMALL_PADDING), + textAlign = TextAlign.End, + color = textColor, + maxLines = 1, + overflow = TextOverflow.Ellipsis ) Text( text = talent.value.toString(), modifier = Modifier + .widthIn(min = 24.dp) .padding(end = SMALL_PADDING), - textAlign = TextAlign.Center, - color = textColor + textAlign = TextAlign.End, + color = textColor, + maxLines = 1, + overflow = TextOverflow.Ellipsis ) } IconButton( @@ -101,4 +114,4 @@ fun Talent( } } } -} \ No newline at end of file +}