Skip to content

Commit

Permalink
feat: [ANDROAPP-5739] small corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
xavimolloy committed Jun 18, 2024
1 parent a72f43a commit 48d09aa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ val basicAdditionalItemListWithLongValue = listOf(
val enrollmentCompletedList = listOf(
AdditionalInfoItem(key = "Phone:", value = "+234 123 111 6785"),
AdditionalInfoItem(key = "Date of birth:", value = "12/12/1945"),
AdditionalInfoItem(key = "Address:", value = "134 Main Road, Behind the temple, Citytown, Basil District, Granite State"),
AdditionalInfoItem(key = "Address:", value = "134 Main Road, Behind the temple, Citytown, Basil District"),
AdditionalInfoItem(key = "Enrolled in:", value = "12/12/1945"),
AdditionalInfoItem(
key = lorem,
Expand All @@ -57,7 +57,7 @@ val teiDetailList = listOf(
AdditionalInfoItem(key = "National ID:", value = "001-224-789"),
AdditionalInfoItem(
key = lorem,
value = "+234 123 111 6785",
value = "+234 554",
icon = {
Icon(
imageVector = Icons.Filled.PhoneEnabled,
Expand All @@ -70,6 +70,7 @@ val teiDetailList = listOf(
),
AdditionalInfoItem(key = lorem, value = lorem),
AdditionalInfoItem(key = "Enrolled in:", value = "PHC Blueberry"),
AdditionalInfoItem(value = "PHC Blueberry"),
AdditionalInfoItem(
key = lorem,
value = "Tuberculosis, Nutrition, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ private fun KeyValue(
isDetailCard: Boolean = false,
modifier: Modifier = Modifier,
) {
BoxWithConstraints(modifier = modifier.fillMaxWidth()) {
BoxWithConstraints(modifier = modifier) {
val maxKeyWidth = maxWidth / 2 - Spacing.Spacing16
ProvideKeyValueItem(additionalInfoItem, maxKeyWidth, isDetailCard)
}
Expand All @@ -442,7 +442,7 @@ fun ProvideKeyValueItem(additionalInfoItem: AdditionalInfoItem, maxKeyWidth: Dp,
val keyTrimmedText = if (keyWidth > maxKeyWidth) {
getKeyTrimmedText(keyText ?: "", maxKeyWidth, textMeasurer)
} else {
additionalInfoItem.key ?: " "
additionalInfoItem.key ?: ""
}

val additionalInfoKey = buildAnnotatedString {
Expand All @@ -463,7 +463,7 @@ fun ProvideKeyValueItem(additionalInfoItem: AdditionalInfoItem, maxKeyWidth: Dp,
withStyle(
style = valueStyle,
) {
append(" $valueText")
append(if (keyText?.isNotEmpty() == true) " $valueText" else valueText)
}
}
}
Expand Down Expand Up @@ -491,7 +491,7 @@ fun ProvideKeyValueItem(additionalInfoItem: AdditionalInfoItem, maxKeyWidth: Dp,
)

Row(
modifier = Modifier.fillMaxWidth()
modifier = Modifier
.clip(shape = RoundedCornerShape(Radius.XS))
.conditional(additionalInfoItem.action != null && isDetailCard, {
clickable(
Expand Down Expand Up @@ -563,12 +563,12 @@ fun getKeyTrimmedText(text: String, maxKeyWidth: Dp, textMeasurer: TextMeasurer)
var trimmedText = remember { text.substring(IntRange(0, lastCharIndex)) }
var newKeyWidth = measureTextWidth(trimmedText, textMeasurer)

while (newKeyWidth < maxKeyWidth) {
while (newKeyWidth < maxKeyWidth && lastCharIndex < text.length) {
lastCharIndex++
trimmedText = text.substring(IntRange(0, lastCharIndex))
newKeyWidth = measureTextWidth(trimmedText, textMeasurer)
}
return trimmedText.dropLast(1) + "...: "
return trimmedText.dropLast(1).trimEnd() + "...: "
}

enum class
Expand Down

0 comments on commit 48d09aa

Please sign in to comment.