Updated on 2026-08-14
This commit is contained in:
parent
dbdffaa974
commit
8509912947
15 changed files with 402 additions and 57 deletions
|
|
@ -172,7 +172,7 @@ private fun Modifier.tokenClickable(state: TokenItemState): Modifier = composed
|
|||
/**
|
||||
* IMPORTANT! All margins that used between children setup like as children paddings.
|
||||
*/
|
||||
@Suppress("LongMethod")
|
||||
@Suppress("LongMethod", "CyclomaticComplexMethod")
|
||||
@Composable
|
||||
private fun CustomContainer(state: TokenItemState, modifier: Modifier = Modifier, content: @Composable () -> Unit) {
|
||||
val density = LocalDensity.current
|
||||
|
|
@ -215,20 +215,24 @@ private fun CustomContainer(state: TokenItemState, modifier: Modifier = Modifier
|
|||
is TokenItemState.Loading,
|
||||
is TokenItemState.Locked,
|
||||
-> {
|
||||
fiatAmount = measurables.measureFiatAmount(
|
||||
state = state,
|
||||
maxWidth = layoutWidth - icon.width - titleMinWidth,
|
||||
defaultConstraints = constraints,
|
||||
)
|
||||
if (state.fiatAmountState != null) {
|
||||
fiatAmount = measurables.measureFiatAmount(
|
||||
state = state,
|
||||
maxWidth = layoutWidth - icon.width - titleMinWidth,
|
||||
defaultConstraints = constraints,
|
||||
)
|
||||
}
|
||||
|
||||
cryptoAmount = measurables.measureCryptoAmount(
|
||||
state = state,
|
||||
maxWidth = layoutWidth - icon.width - priceChangeMinWidth,
|
||||
defaultConstraints = constraints,
|
||||
)
|
||||
if (state.subtitle2State != null) {
|
||||
cryptoAmount = measurables.measureCryptoAmount(
|
||||
state = state,
|
||||
maxWidth = layoutWidth - icon.width - priceChangeMinWidth,
|
||||
defaultConstraints = constraints,
|
||||
)
|
||||
}
|
||||
|
||||
firstRowRemainingFreeSpace = layoutWidth - icon.width - fiatAmount.width
|
||||
secondRowRemainingFreeSpace = layoutWidth - icon.width - cryptoAmount.width
|
||||
firstRowRemainingFreeSpace = layoutWidth - icon.width - (fiatAmount?.width ?: 0)
|
||||
secondRowRemainingFreeSpace = layoutWidth - icon.width - (cryptoAmount?.width ?: 0)
|
||||
}
|
||||
is TokenItemState.Draggable -> {
|
||||
cryptoAmount = measurables.measureCryptoAmount(
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ sealed class TokenItemState {
|
|||
* @property titleState token title
|
||||
* @property subtitleState token subtitle
|
||||
* @property fiatAmountState token fiat amount
|
||||
* @property subtitle2State token crypto amount
|
||||
* @property subtitle2State token subtitle 2 (example, token crypto amount)
|
||||
* @property onItemClick callback which will be called when an item is clicked
|
||||
* @property onItemLongClick callback which will be called when an item is long clicked
|
||||
*/
|
||||
|
|
@ -91,8 +91,8 @@ sealed class TokenItemState {
|
|||
override val iconState: CurrencyIconState,
|
||||
override val titleState: TitleState,
|
||||
override val subtitleState: SubtitleState,
|
||||
override val fiatAmountState: FiatAmountState,
|
||||
override val subtitle2State: Subtitle2State,
|
||||
override val fiatAmountState: FiatAmountState?,
|
||||
override val subtitle2State: Subtitle2State?,
|
||||
override val onItemClick: ((TokenItemState) -> Unit)?,
|
||||
override val onItemLongClick: ((TokenItemState) -> Unit)?,
|
||||
) : TokenItemState()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue