Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer previewing via Icon over Image #26

Closed
wants to merge 1 commit into from
Closed
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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ private var _Add: ImageVector? = null

```kotlin
import androidx.compose.runtime.Composable
import androidx.compose.foundation.Image
import androidx.compose.ui.graphics.SolidColor
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.StrokeCap
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ internal fun iconPreviewSpecForNestedPack(
)
addStatement(
format = "%M(imageVector = %T, contentDescription = null)",
MemberNames.Image,
MemberNames.Icon,
iconPackClassName.nestedClass(iconName)
)
endControlFlow()
Expand All @@ -54,7 +54,7 @@ internal fun iconPreviewSpec(
)
addStatement(
format = "%M(imageVector = %M, contentDescription = null)",
MemberNames.Image,
MemberNames.Icon,
MemberName(
packageName = iconPackage,
simpleName = iconName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ class PreviewGenerationTest {
val expectedOutput = """
package io.github.composegears.valkyrie.icons

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
Expand Down Expand Up @@ -55,7 +55,7 @@ class PreviewGenerationTest {
@Composable
private fun WithoutPathPreview() {
Box(modifier = Modifier.padding(12.dp)) {
Image(imageVector = WithoutPath, contentDescription = null)
Icon(imageVector = WithoutPath, contentDescription = null)
}
}

Expand All @@ -81,9 +81,9 @@ class PreviewGenerationTest {
val expectedOutput = """
package io.github.composegears.valkyrie.icons

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
Expand Down Expand Up @@ -112,7 +112,7 @@ class PreviewGenerationTest {
@Composable
private fun WithoutPathPreview() {
Box(modifier = Modifier.padding(12.dp)) {
Image(imageVector = ValkyrieIcons.WithoutPath, contentDescription = null)
Icon(imageVector = ValkyrieIcons.WithoutPath, contentDescription = null)
}
}

Expand All @@ -138,9 +138,9 @@ class PreviewGenerationTest {
val expectedOutput = """
package io.github.composegears.valkyrie.icons.filled

import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.vector.ImageVector
Expand Down Expand Up @@ -170,7 +170,7 @@ class PreviewGenerationTest {
@Composable
private fun WithoutPathPreview() {
Box(modifier = Modifier.padding(12.dp)) {
Image(imageVector = ValkyrieIcons.Filled.WithoutPath, contentDescription = null)
Icon(imageVector = ValkyrieIcons.Filled.WithoutPath, contentDescription = null)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal enum class PackageNames(val packageName: String) {
LayoutPackage(FoundationPackage.packageName + ".layout"),
PreviewPackage(UiPackage.packageName + ".tooling.preview"),
RuntimePackage("androidx.compose.runtime"),
Material3Package("androidx.compose.material3")
}

/**
Expand Down Expand Up @@ -62,7 +63,7 @@ object MemberNames {
val Modifier = MemberName(PackageNames.UiPackage.packageName, "Modifier")
val Padding = MemberName(PackageNames.LayoutPackage.packageName, "padding")
val Box = MemberName(PackageNames.LayoutPackage.packageName, "Box")
val Image = MemberName(PackageNames.FoundationPackage.packageName, "Image")
val Icon = MemberName(PackageNames.Material3Package.packageName, "Icon")

val Color = MemberName(PackageNames.GraphicsPackage.packageName, "Color")
val SolidColor = MemberName(PackageNames.GraphicsPackage.packageName, "SolidColor")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package io.github.composegears.valkyrie.ui.screen.mode.iconpack.conversion.ui.batch

import androidx.compose.desktop.ui.tooling.preview.Preview
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.gestures.detectTapGestures
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Icon
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.setValue
Expand Down Expand Up @@ -62,7 +62,7 @@ fun IconPreviewBox(painter: Painter) {
)
}
}
Image(
Icon(
modifier = Modifier.size(36.dp),
painter = painter,
contentDescription = null
Expand Down