Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
Fix PieChartScreen IconSize
Browse files Browse the repository at this point in the history
  • Loading branch information
Vishwa-Raghavendra committed May 6, 2022
1 parent 00f5951 commit 9624d2c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import androidx.compose.ui.draw.alpha
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.font.FontWeight
Expand Down Expand Up @@ -337,13 +338,23 @@ private fun CategoryAmountCard(
) {
Spacer(Modifier.width(20.dp))

ItemIconMDefaultIcon(
ItemIconM(
modifier = Modifier.background(categoryColor, CircleShape),
iconName = category?.icon,
defaultIcon = R.drawable.ic_custom_category_m,
tint = findContrastTextColor(categoryColor)
tint = findContrastTextColor(categoryColor),
iconContentScale = ContentScale.None,
Default = {
ItemIconMDefaultIcon(
modifier = Modifier.background(categoryColor, CircleShape),
iconName = category?.icon,
defaultIcon = R.drawable.ic_custom_category_m,
tint = findContrastTextColor(categoryColor)
)
}
)



Spacer(Modifier.width(16.dp))

Column(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ fun ItemIconL(
modifier: Modifier = Modifier,
iconName: String?,
tint: Color = UI.colors.pureInverse,
iconContentScale: ContentScale? = null,
Default: (@Composable () -> Unit)? = null
) {
ItemIcon(
Expand All @@ -34,6 +35,7 @@ fun ItemIconL(
size = "l",
iconName = iconName,
tint = tint,
iconContentScale = iconContentScale,
Default = Default
)
}
Expand Down Expand Up @@ -65,6 +67,7 @@ fun ItemIconM(
modifier: Modifier = Modifier,
iconName: String?,
tint: Color = UI.colors.pureInverse,
iconContentScale: ContentScale? = null,
Default: (@Composable () -> Unit)? = null
) {
ItemIcon(
Expand All @@ -73,6 +76,7 @@ fun ItemIconM(
size = "m",
iconName = iconName,
tint = tint,
iconContentScale = iconContentScale,
Default = Default
)
}
Expand Down Expand Up @@ -104,6 +108,7 @@ fun ItemIconS(
modifier: Modifier = Modifier,
iconName: String?,
tint: Color = UI.colors.pureInverse,
iconContentScale: ContentScale? = null,
Default: (@Composable () -> Unit)? = null
) {
ItemIcon(
Expand All @@ -112,6 +117,7 @@ fun ItemIconS(
size = "s",
iconName = iconName,
tint = tint,
iconContentScale = iconContentScale,
Default = Default
)
}
Expand All @@ -122,6 +128,7 @@ private fun ItemIcon(
iconName: String?,
size: String,
tint: Color = UI.colors.pureInverse,
iconContentScale: ContentScale? = null,
Default: (@Composable () -> Unit)? = null
) {
val context = LocalContext.current
Expand Down Expand Up @@ -157,7 +164,7 @@ private fun ItemIcon(
painter = painterResource(id = iconInfo.iconId),
colorFilter = ColorFilter.tint(tint),
alignment = Alignment.Center,
contentScale = if (iconInfo.newFormat)
contentScale = iconContentScale ?: if (iconInfo.newFormat)
ContentScale.Fit else ContentScale.None,
contentDescription = iconName ?: "item icon"
)
Expand Down

0 comments on commit 9624d2c

Please sign in to comment.