diff --git a/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticScreen.kt b/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticScreen.kt index cef77bbaf0..21db1574c2 100644 --- a/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticScreen.kt +++ b/app/src/main/java/com/ivy/wallet/ui/statistic/level1/PieChartStatisticScreen.kt @@ -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 @@ -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( diff --git a/app/src/main/java/com/ivy/wallet/ui/theme/components/ItemIcon.kt b/app/src/main/java/com/ivy/wallet/ui/theme/components/ItemIcon.kt index d1c6f0598f..bfc4dcf6fa 100644 --- a/app/src/main/java/com/ivy/wallet/ui/theme/components/ItemIcon.kt +++ b/app/src/main/java/com/ivy/wallet/ui/theme/components/ItemIcon.kt @@ -26,6 +26,7 @@ fun ItemIconL( modifier: Modifier = Modifier, iconName: String?, tint: Color = UI.colors.pureInverse, + iconContentScale: ContentScale? = null, Default: (@Composable () -> Unit)? = null ) { ItemIcon( @@ -34,6 +35,7 @@ fun ItemIconL( size = "l", iconName = iconName, tint = tint, + iconContentScale = iconContentScale, Default = Default ) } @@ -65,6 +67,7 @@ fun ItemIconM( modifier: Modifier = Modifier, iconName: String?, tint: Color = UI.colors.pureInverse, + iconContentScale: ContentScale? = null, Default: (@Composable () -> Unit)? = null ) { ItemIcon( @@ -73,6 +76,7 @@ fun ItemIconM( size = "m", iconName = iconName, tint = tint, + iconContentScale = iconContentScale, Default = Default ) } @@ -104,6 +108,7 @@ fun ItemIconS( modifier: Modifier = Modifier, iconName: String?, tint: Color = UI.colors.pureInverse, + iconContentScale: ContentScale? = null, Default: (@Composable () -> Unit)? = null ) { ItemIcon( @@ -112,6 +117,7 @@ fun ItemIconS( size = "s", iconName = iconName, tint = tint, + iconContentScale = iconContentScale, Default = Default ) } @@ -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 @@ -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" )