Updated on 2026-08-14
This commit is contained in:
parent
e6dc5b37a2
commit
0ad4588d2c
10 changed files with 83 additions and 18 deletions
|
|
@ -16,6 +16,7 @@ import com.tangem.core.ui.extensions.TextReference
|
|||
import com.tangem.core.ui.extensions.resolveReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreview
|
||||
import com.tangem.utils.extensions.orHide
|
||||
import kotlinx.collections.immutable.ImmutableList
|
||||
import kotlinx.collections.immutable.persistentListOf
|
||||
|
||||
|
|
@ -42,6 +43,7 @@ fun LazyListScope.roundedListWithDividersItems(
|
|||
rows: ImmutableList<RoundedListWithDividersItemData>,
|
||||
headerContent: (@Composable () -> Unit)? = null,
|
||||
footerContent: (@Composable () -> Unit)? = null,
|
||||
hideEndText: Boolean = false,
|
||||
) {
|
||||
if (headerContent != null) {
|
||||
item(key = ROUNDED_LIST_WITH_DIVIDERS_HEADER_KEY) {
|
||||
|
|
@ -55,7 +57,7 @@ fun LazyListScope.roundedListWithDividersItems(
|
|||
) { index, row ->
|
||||
InitialInfoContentRow(
|
||||
startText = row.startText.resolveReference(),
|
||||
endText = row.endText.resolveReference(),
|
||||
endText = row.endText.resolveReference().orHide(hideEndText && row.isEndTextHideable),
|
||||
cornersToRound = getCornersToRound(index, rows.size),
|
||||
iconClick = row.iconClick,
|
||||
)
|
||||
|
|
@ -126,6 +128,7 @@ data class RoundedListWithDividersItemData(
|
|||
val startText: TextReference,
|
||||
val endText: TextReference,
|
||||
val iconClick: (() -> Unit)? = null,
|
||||
val isEndTextHideable: Boolean = false,
|
||||
)
|
||||
|
||||
@Composable
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import androidx.compose.ui.res.stringResource
|
|||
import androidx.compose.ui.text.AnnotatedString
|
||||
import androidx.compose.ui.text.AnnotatedString.Builder
|
||||
import androidx.compose.ui.text.buildAnnotatedString
|
||||
import com.tangem.utils.StringsSigns.STARS
|
||||
import org.intellij.markdown.MarkdownElementTypes
|
||||
import kotlin.contracts.ExperimentalContracts
|
||||
import kotlin.contracts.contract
|
||||
|
|
@ -250,4 +251,17 @@ private fun formatAnnotated(rawString: String): AnnotatedString {
|
|||
return buildAnnotatedString {
|
||||
appendMarkdown(markdownText = rawString, node = parsedTree)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the TextReference itself if hide is false, otherwise returns a reference with STARS.
|
||||
*
|
||||
* @param mask A boolean flag that determines whether to hide the string.
|
||||
* If true, the original TextReference will be replaced by reference with STARS.
|
||||
* If false, the original TextReference will be returned.
|
||||
*
|
||||
* @return The original reference if hide is false, or reference with STARS if hide is true.
|
||||
*/
|
||||
fun TextReference.orMaskWithStars(mask: Boolean) : TextReference {
|
||||
return if (mask) stringReference(STARS) else this
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue