Updated on 2026-08-14
This commit is contained in:
parent
aecd523c70
commit
139b4ffdc6
9 changed files with 106 additions and 99 deletions
|
|
@ -27,19 +27,20 @@ import com.tangem.core.ui.extensions.*
|
|||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||
import com.tangem.core.ui.test.TokenElementsTestTags
|
||||
import org.burnoutcrew.reorderable.ReorderableLazyListState
|
||||
|
||||
/**
|
||||
* UI model for header row component
|
||||
*
|
||||
* @param headerRowUM UI model for the header row
|
||||
* @param modifier Modifier for the composable
|
||||
* @param headerRowUM UI model for the header row
|
||||
* @param modifier Modifier for the composable
|
||||
* @param dragHandleModifier Modifier applied to the drag handle in the row's tail (e.g. a reorderable
|
||||
* drag-handle modifier). Defaults to [Modifier] for non-reorderable rows.
|
||||
*/
|
||||
@Composable
|
||||
fun TangemHeaderRow(
|
||||
headerRowUM: TangemHeaderRowUM,
|
||||
modifier: Modifier = Modifier,
|
||||
reorderableState: ReorderableLazyListState? = null,
|
||||
dragHandleModifier: Modifier = Modifier,
|
||||
isBalanceHidden: Boolean = false,
|
||||
) {
|
||||
TangemHeaderRow(
|
||||
|
|
@ -48,7 +49,7 @@ fun TangemHeaderRow(
|
|||
title = headerRowUM.title,
|
||||
subtitle = headerRowUM.subtitle,
|
||||
isBalanceHidden = isBalanceHidden,
|
||||
reorderableState = reorderableState,
|
||||
dragHandleModifier = dragHandleModifier,
|
||||
modifier = modifier,
|
||||
)
|
||||
}
|
||||
|
|
@ -129,7 +130,7 @@ fun TangemHeaderRow(
|
|||
subtitle: TextReference? = null,
|
||||
headTangemIconUM: TangemIconUM? = null,
|
||||
tailUM: TangemRowTailUM = TangemRowTailUM.Empty,
|
||||
reorderableState: ReorderableLazyListState? = null,
|
||||
dragHandleModifier: Modifier = Modifier,
|
||||
isEnabled: Boolean = false,
|
||||
onItemClick: (() -> Unit)? = null,
|
||||
) {
|
||||
|
|
@ -181,7 +182,7 @@ fun TangemHeaderRow(
|
|||
SpacerWMax()
|
||||
TangemRowTail(
|
||||
tangemRowTailUM = tailUM,
|
||||
reorderableState = reorderableState,
|
||||
dragHandleModifier = dragHandleModifier,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,14 +19,12 @@ import com.tangem.core.ui.extensions.TextReference
|
|||
import com.tangem.core.ui.extensions.resolveAnnotatedReference
|
||||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.test.OrganizeTokensScreenTestTags
|
||||
import org.burnoutcrew.reorderable.ReorderableLazyListState
|
||||
import org.burnoutcrew.reorderable.detectReorder
|
||||
|
||||
@Composable
|
||||
fun TangemRowTail(
|
||||
tangemRowTailUM: TangemRowTailUM,
|
||||
modifier: Modifier = Modifier,
|
||||
reorderableState: ReorderableLazyListState? = null,
|
||||
dragHandleModifier: Modifier = Modifier,
|
||||
) {
|
||||
AnimatedContent(
|
||||
targetState = tangemRowTailUM,
|
||||
|
|
@ -39,7 +37,7 @@ fun TangemRowTail(
|
|||
TangemRowTailUM.Empty -> Unit
|
||||
is TangemRowTailUM.Draggable -> DraggableImage(
|
||||
iconRes = animatedState.iconRes,
|
||||
reorderableState = reorderableState,
|
||||
dragHandleModifier = dragHandleModifier,
|
||||
modifier = innerModifier,
|
||||
)
|
||||
is TangemRowTailUM.Text -> ContentText(text = animatedState.text, modifier = innerModifier)
|
||||
|
|
@ -54,21 +52,11 @@ fun TangemRowTail(
|
|||
}
|
||||
|
||||
@Composable
|
||||
private fun DraggableImage(
|
||||
@DrawableRes iconRes: Int,
|
||||
reorderableState: ReorderableLazyListState?,
|
||||
modifier: Modifier = Modifier,
|
||||
) {
|
||||
private fun DraggableImage(@DrawableRes iconRes: Int, dragHandleModifier: Modifier, modifier: Modifier = Modifier) {
|
||||
Box(
|
||||
modifier = modifier
|
||||
.size(size = TangemTheme.dimens2.x6)
|
||||
.then(
|
||||
other = if (reorderableState != null) {
|
||||
Modifier.detectReorder(reorderableState)
|
||||
} else {
|
||||
Modifier
|
||||
},
|
||||
)
|
||||
.then(dragHandleModifier)
|
||||
.testTag(OrganizeTokensScreenTestTags.DRAGGABLE_IMAGE),
|
||||
contentAlignment = Alignment.Center,
|
||||
) {
|
||||
|
|
|
|||
|
|
@ -21,24 +21,24 @@ import com.tangem.core.ui.extensions.clickableSingle
|
|||
import com.tangem.core.ui.res.TangemTheme
|
||||
import com.tangem.core.ui.res.TangemThemePreviewRedesign
|
||||
import com.tangem.core.ui.test.TokenElementsTestTags
|
||||
import org.burnoutcrew.reorderable.ReorderableLazyListState
|
||||
|
||||
/**
|
||||
* Composable function that represents a Tangem token row in a list.
|
||||
*
|
||||
* [Token Row](https://www.figma.com/design/RU7AIgwHtGdMfy83T5UOoR/Core-Library?node-id=8207-17583&t=k8dyaykorsNocGVq-4)
|
||||
*
|
||||
* @param tokenRowUM The user model containing the data for the token row.
|
||||
* @param isBalanceHidden A boolean indicating whether the balance should be hidden.
|
||||
* @param reorderableState The state of the reorderable lazy list, if applicable.
|
||||
* @param modifier The modifier to be applied to the row.
|
||||
* @param tokenRowUM The user model containing the data for the token row.
|
||||
* @param isBalanceHidden A boolean indicating whether the balance should be hidden.
|
||||
* @param dragHandleModifier Modifier applied to the drag handle in the row's tail (e.g. a reorderable
|
||||
* drag-handle modifier). Defaults to [Modifier] for non-reorderable rows.
|
||||
* @param modifier The modifier to be applied to the row.
|
||||
*/
|
||||
@Composable
|
||||
fun TangemTokenRow(
|
||||
tokenRowUM: TangemTokenRowUM,
|
||||
isBalanceHidden: Boolean,
|
||||
reorderableState: ReorderableLazyListState?,
|
||||
modifier: Modifier = Modifier,
|
||||
dragHandleModifier: Modifier = Modifier,
|
||||
) {
|
||||
TangemRowContainer(
|
||||
content = {
|
||||
|
|
@ -91,7 +91,7 @@ fun TangemTokenRow(
|
|||
|
||||
TangemRowTail(
|
||||
tangemRowTailUM = tokenRowUM.tailUM,
|
||||
reorderableState = reorderableState,
|
||||
dragHandleModifier = dragHandleModifier,
|
||||
modifier = Modifier
|
||||
.layoutId(layoutId = TangemRowLayoutId.TAIL)
|
||||
.testTag(tag = TokenElementsTestTags.TOKEN_NON_FIAT_BLOCK),
|
||||
|
|
@ -116,18 +116,19 @@ fun TangemTokenRow(
|
|||
* [Token Row](https://www.figma.com/design/RU7AIgwHtGdMfy83T5UOoR/Core-Library?node-id=8207-17583&t=k8dyaykorsNocGVq-4)
|
||||
*
|
||||
* @param tokenRowUM The user model containing the data for the token row.
|
||||
* @param headComponent The composable function representing the head component.
|
||||
* @param titleComponent The composable function representing the title component.
|
||||
* @param isBalanceHidden A boolean indicating whether the balance should be hidden.
|
||||
* @param reorderableState The state of the reorderable lazy list, if applicable.
|
||||
* @param modifier The modifier to be applied to the row.
|
||||
* @param headComponent The composable function representing the head component.
|
||||
* @param titleComponent The composable function representing the title component.
|
||||
* @param isBalanceHidden A boolean indicating whether the balance should be hidden.
|
||||
* @param dragHandleModifier Modifier applied to the drag handle in the row's tail (e.g. a reorderable
|
||||
* drag-handle modifier). Defaults to [Modifier] for non-reorderable rows.
|
||||
* @param modifier The modifier to be applied to the row.
|
||||
*/
|
||||
@Composable
|
||||
fun TangemTokenRow(
|
||||
tokenRowUM: TangemTokenRowUM,
|
||||
isBalanceHidden: Boolean,
|
||||
reorderableState: ReorderableLazyListState?,
|
||||
modifier: Modifier = Modifier,
|
||||
dragHandleModifier: Modifier = Modifier,
|
||||
headComponent: @Composable (Modifier) -> Unit,
|
||||
titleComponent: @Composable (Modifier) -> Unit,
|
||||
) {
|
||||
|
|
@ -190,7 +191,7 @@ fun TangemTokenRow(
|
|||
|
||||
TangemRowTail(
|
||||
tangemRowTailUM = tokenRowUM.tailUM,
|
||||
reorderableState = reorderableState,
|
||||
dragHandleModifier = dragHandleModifier,
|
||||
modifier = Modifier
|
||||
.layoutId(layoutId = TangemRowLayoutId.TAIL)
|
||||
.testTag(tag = TokenElementsTestTags.TOKEN_NON_FIAT_BLOCK),
|
||||
|
|
@ -210,7 +211,6 @@ private fun TangemTokenRow_Preview(
|
|||
TangemTokenRow(
|
||||
tokenRowUM = tokenRowUM,
|
||||
isBalanceHidden = false,
|
||||
reorderableState = null,
|
||||
modifier = Modifier.background(TangemTheme.colors2.surface.level1),
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue