Change Icon to Material 3

This commit is contained in:
Wolf-Martell Montwé 2024-04-17 12:51:11 +02:00
parent 71f6713a2e
commit facef2ac85
No known key found for this signature in database
GPG key ID: 6D45B21512ACBF72
2 changed files with 32 additions and 29 deletions

View file

@ -0,0 +1,27 @@
package app.k9mail.core.ui.compose.designsystem.atom.icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.designsystem.PreviewWithThemes
@Preview(showBackground = true)
@Composable
internal fun IconPreview() {
PreviewWithThemes {
Icon(
imageVector = Icons.Filled.error,
)
}
}
@Preview(showBackground = true)
@Composable
internal fun IconTintedPreview() {
PreviewWithThemes {
Icon(
imageVector = Icons.Filled.error,
tint = Color.Magenta,
)
}
}

View file

@ -1,46 +1,22 @@
package app.k9mail.core.ui.compose.designsystem.atom.icon
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.LocalContentColor
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.vector.ImageVector
import androidx.compose.ui.tooling.preview.Preview
import app.k9mail.core.ui.compose.theme.PreviewWithThemes
import androidx.compose.material.Icon as MaterialIcon
import androidx.compose.material3.Icon as Material3Icon
import androidx.compose.material3.LocalContentColor as Material3LocalContentColor
@Composable
fun Icon(
imageVector: ImageVector,
modifier: Modifier = Modifier,
tint: Color = LocalContentColor.current.copy(alpha = LocalContentAlpha.current),
tint: Color? = null,
) {
MaterialIcon(
Material3Icon(
imageVector = imageVector,
contentDescription = null,
modifier = modifier,
tint = tint,
tint = tint ?: Material3LocalContentColor.current,
)
}
@Preview(showBackground = true)
@Composable
internal fun IconPreview() {
PreviewWithThemes {
Icon(
imageVector = Icons.Filled.error,
)
}
}
@Preview(showBackground = true)
@Composable
internal fun IconTintedPreview() {
PreviewWithThemes {
Icon(
imageVector = Icons.Filled.error,
tint = Color.Magenta,
)
}
}