Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
package com.sdds.compose.uikit.fixtures.testcases

import androidx.compose.runtime.Composable
import androidx.compose.ui.res.painterResource
import com.sdds.compose.uikit.CircularProgressBar
import com.sdds.compose.uikit.File
import com.sdds.compose.uikit.FileActionPlacement
import com.sdds.compose.uikit.FileStyle
import com.sdds.compose.uikit.Icon
import com.sdds.compose.uikit.IconButton
import com.sdds.compose.uikit.ProgressBar
import com.sdds.compose.uikit.resourceImageSource
import com.sdds.icons.R

/**
Expand All @@ -32,7 +32,7 @@ fun FileCircularProgressIsLoadingStart(style: FileStyle) {
progress = 0.5f,
valueContent = {
Icon(
painter = painterResource(id = R.drawable.ic_close_16),
source = resourceImageSource(id = R.drawable.ic_close_16),
contentDescription = "",
)
},
Expand All @@ -53,7 +53,7 @@ fun FileLinearProgressIsLoadingHasImageEnd(style: FileStyle) {
description = "1.2MB",
image = {
Icon(
painterResource(R.drawable.ic_file_check_fill_36),
source = resourceImageSource(R.drawable.ic_file_check_fill_36),
contentDescription = "",
)
},
Expand Down Expand Up @@ -84,7 +84,7 @@ fun FileCircularProgressHasImageEnd(style: FileStyle) {
description = "1.2MB",
image = {
Icon(
painterResource(R.drawable.ic_file_check_fill_36),
resourceImageSource(R.drawable.ic_file_check_fill_36),
contentDescription = "",
)
},
Expand All @@ -94,7 +94,7 @@ fun FileCircularProgressHasImageEnd(style: FileStyle) {
progress = 0.5f,
valueContent = {
Icon(
painter = painterResource(id = R.drawable.ic_close_16),
source = resourceImageSource(id = R.drawable.ic_close_16),
contentDescription = "",
)
},
Expand All @@ -121,7 +121,7 @@ fun FileLinearProgressIsLoadingStart(style: FileStyle) {
description = "1.2MB",
image = {
Icon(
painterResource(R.drawable.ic_file_check_fill_36),
resourceImageSource(R.drawable.ic_file_check_fill_36),
contentDescription = "",
)
},
Expand Down Expand Up @@ -157,7 +157,7 @@ fun FileCircularProgressIsLoadingEndLongText(style: FileStyle) {
progress = 0.5f,
valueContent = {
Icon(
painter = painterResource(id = R.drawable.ic_close_16),
source = resourceImageSource(id = R.drawable.ic_close_16),
contentDescription = "",
)
},
Expand All @@ -178,7 +178,7 @@ fun FileCircularProgressIsLoadingHasImageNoDesc(style: FileStyle) {
description = "",
image = {
Icon(
painterResource(R.drawable.ic_file_check_fill_36),
resourceImageSource(R.drawable.ic_file_check_fill_36),
contentDescription = "",
)
},
Expand All @@ -188,7 +188,7 @@ fun FileCircularProgressIsLoadingHasImageNoDesc(style: FileStyle) {
progress = 0.5f,
valueContent = {
Icon(
painter = painterResource(id = R.drawable.ic_close_16),
source = resourceImageSource(id = R.drawable.ic_close_16),
contentDescription = "",
)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ import androidx.compose.ui.text.AnnotatedString
import com.sdds.compose.uikit.internal.cell.BaseCell
import com.sdds.compose.uikit.internal.cell.CellCenterContent
import com.sdds.compose.uikit.internal.common.StyledText
import com.sdds.compose.uikit.motion.Motion
import com.sdds.compose.uikit.motion.components.cell.CellMotionStyle
import com.sdds.compose.uikit.motion.components.cell.rememberCellMotion
import com.sdds.compose.uikit.motion.getBrushAsState
import com.sdds.compose.uikit.motion.rememberMotionContext

/**
* Компонент Cell.
Expand All @@ -28,6 +33,7 @@ import com.sdds.compose.uikit.internal.common.StyledText
* @param startContent контент в начале
* @param endContent контент в конце
* @param interactionSource источник взаимодействий
* @param motion объект анимаций
*/
@Composable
fun Cell(
Expand All @@ -41,6 +47,9 @@ fun Cell(
startContent: (@Composable RowScope.() -> Unit)? = null,
endContent: (@Composable RowScope.() -> Unit)? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
motion: Motion<CellMotionStyle> = rememberCellMotion(
motionContext = rememberMotionContext(interactionSource),
),
) {
BaseCell(
modifier = modifier,
Expand All @@ -59,7 +68,7 @@ fun Cell(
endContent = endContent,
disclosureEnabled = disclosureContent != null,
disclosureContent = disclosureContent,
interactionSource = interactionSource,
interactionSource = motion.context.interactionSource,
)
}

Expand Down Expand Up @@ -93,6 +102,9 @@ fun Cell(
startContent: (@Composable RowScope.() -> Unit)? = null,
endContent: (@Composable RowScope.() -> Unit)? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
motion: Motion<CellMotionStyle> = rememberCellMotion(
motionContext = rememberMotionContext(interactionSource),
),
) {
BaseCell(
modifier = modifier,
Expand All @@ -104,33 +116,37 @@ fun Cell(
label = label,
subtitle = subtitle,
style = style,
interactionSource = interactionSource,
interactionSource = motion.context.interactionSource,
)
},
startContent = startContent,
endContent = endContent,
disclosureEnabled = disclosureContentEnabled,
disclosureContent = {
val textColor = style.colors.disclosureTextBrush.getBrushAsState(
motion.context,
motion.style.disclosureTextColor,
)
StyledText(
text = disclosureText,
textStyle = style.disclosureTextStyle,
textColor = style.colors.disclosureTextColor.colorForInteraction(
interactionSource,
),
textColor = textColor.value,
)
val iconRes = disclosureIconRes ?: style.disclosureIconRes
val painter = iconRes?.let { painterResource(it) } ?: style.disclosureIcon
painter?.let {
val iconColor = style.colors.disclosureIconBrush.getBrushAsState(
motion.context,
motion.style.disclosureIconColor,
)
Icon(
painter = it,
contentDescription = "",
tint = style.colors.disclosureIconColor.colorForInteraction(
interactionSource,
),
brush = { iconColor.value },
)
}
},
interactionSource = interactionSource,
interactionSource = motion.context.interactionSource,
)
}

Expand Down Expand Up @@ -233,6 +249,9 @@ fun Cell(
centerContent: (@Composable ColumnScope.() -> Unit)? = null,
endContent: (@Composable RowScope.() -> Unit)? = null,
interactionSource: MutableInteractionSource = remember { MutableInteractionSource() },
motion: Motion<CellMotionStyle> = rememberCellMotion(
motionContext = rememberMotionContext(interactionSource),
),
) {
BaseCell(
modifier = modifier,
Expand All @@ -243,7 +262,7 @@ fun Cell(
startContent = startContent,
centerContent = centerContent,
endContent = endContent,
interactionSource = interactionSource,
interactionSource = motion.context.interactionSource,
)
}

Expand Down
Loading
Loading