TP-79518|Venkat Praneeth| Addition of overFlow and maxLines properties for spannableTextRenderer (#545)
This commit is contained in:
committed by
GitHub
parent
588ff9932d
commit
2eba44e3fd
@@ -13,6 +13,8 @@ data class SpannableProperty(
|
||||
var includeFontPadding: Boolean? = null,
|
||||
var brushData: BrushData? = null,
|
||||
var lineHeight: Float? = null,
|
||||
var maxLines: Int? = null,
|
||||
var overflow: String? = null
|
||||
) : BaseProperty() {
|
||||
override fun copyNonNullFrom(property: BaseProperty?) {
|
||||
super.copyNonNullFrom(property)
|
||||
@@ -22,6 +24,8 @@ data class SpannableProperty(
|
||||
spannableProperty?.includeFontPadding?.let { includeFontPadding = it }
|
||||
spannableProperty?.brushData?.let { brushData = it }
|
||||
spannableProperty?.lineHeight?.let { lineHeight = it }
|
||||
spannableProperty?.maxLines?.let { maxLines = it }
|
||||
spannableProperty?.overflow?.let { overflow = it }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,6 +41,7 @@ import com.navi.uitron.utils.clip
|
||||
import com.navi.uitron.utils.getText
|
||||
import com.navi.uitron.utils.getTextAlignment
|
||||
import com.navi.uitron.utils.getTextDecoration
|
||||
import com.navi.uitron.utils.getTextOverflow
|
||||
import com.navi.uitron.utils.getTransformedText
|
||||
import com.navi.uitron.utils.hexToComposeColor
|
||||
import com.navi.uitron.utils.isNotNull
|
||||
@@ -137,12 +138,20 @@ class SpannableTextRenderer : Renderer<SpannableProperty> {
|
||||
|
||||
// Render
|
||||
if (spannableData?.textMap.isNotNull()) {
|
||||
BasicText(text = annotatedString, modifier = textModifier, style = textStyle)
|
||||
BasicText(
|
||||
text = annotatedString,
|
||||
modifier = textModifier,
|
||||
style = textStyle,
|
||||
maxLines = property.maxLines ?: Int.MAX_VALUE,
|
||||
overflow = getTextOverflow(property.overflow)
|
||||
)
|
||||
} else {
|
||||
ClickableText(
|
||||
text = annotatedString,
|
||||
modifier = textModifier,
|
||||
style = textStyle,
|
||||
maxLines = property.maxLines ?: Int.MAX_VALUE,
|
||||
overflow = getTextOverflow(property.overflow),
|
||||
onClick = { offset ->
|
||||
spannableData?.spanData?.forEach { spanData ->
|
||||
if (spanData.tag != null) {
|
||||
|
||||
Reference in New Issue
Block a user