-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show how to create icons in standalone sample (#139)
Also clean up related code
- Loading branch information
Showing
8 changed files
with
160 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package org.jetbrains.jewel | ||
|
||
import androidx.compose.foundation.Indication | ||
import androidx.compose.foundation.IndicationInstance | ||
import androidx.compose.foundation.interaction.InteractionSource | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.ui.graphics.drawscope.ContentDrawScope | ||
|
||
object NoIndication : Indication { | ||
|
||
private object NoIndicationInstance : IndicationInstance { | ||
|
||
override fun ContentDrawScope.drawIndication() { | ||
drawContent() | ||
} | ||
} | ||
|
||
@Composable | ||
override fun rememberUpdatedInstance(interactionSource: InteractionSource): IndicationInstance = | ||
NoIndicationInstance | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
...les/standalone/src/main/kotlin/org/jetbrains/jewel/samples/standalone/components/Icons.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.jetbrains.jewel.samples.standalone.components | ||
|
||
import androidx.compose.foundation.layout.Arrangement | ||
import androidx.compose.foundation.layout.Row | ||
import androidx.compose.foundation.layout.fillMaxWidth | ||
import androidx.compose.foundation.layout.padding | ||
import androidx.compose.foundation.layout.size | ||
import androidx.compose.runtime.Composable | ||
import androidx.compose.runtime.getValue | ||
import androidx.compose.runtime.remember | ||
import androidx.compose.ui.Modifier | ||
import androidx.compose.ui.graphics.BlendMode | ||
import androidx.compose.ui.graphics.Color | ||
import androidx.compose.ui.graphics.ColorFilter | ||
import androidx.compose.ui.res.ResourceLoader | ||
import androidx.compose.ui.unit.dp | ||
import org.jetbrains.jewel.GroupHeader | ||
import org.jetbrains.jewel.Icon | ||
import org.jetbrains.jewel.SvgLoader | ||
import org.jetbrains.jewel.styling.ResourcePainterProvider | ||
|
||
@Composable | ||
internal fun Icons(svgLoader: SvgLoader, resourceLoader: ResourceLoader) { | ||
GroupHeader("Icons") | ||
|
||
Row( | ||
modifier = Modifier.fillMaxWidth().padding(horizontal = 16.dp), | ||
horizontalArrangement = Arrangement.spacedBy(16.dp), | ||
) { | ||
val jewelLogoProvider = remember { ResourcePainterProvider.stateless("icons/jewel-logo.svg", svgLoader) } | ||
val jewelLogo by jewelLogoProvider.getPainter(resourceLoader) | ||
|
||
Icon(jewelLogo, "Jewel Logo", Modifier.size(16.dp)) | ||
Icon(jewelLogo, "Jewel Logo", Modifier.size(32.dp)) | ||
Icon(jewelLogo, "Jewel Logo", Modifier.size(64.dp)) | ||
Icon(jewelLogo, "Jewel Logo", Modifier.size(128.dp)) | ||
Icon(jewelLogo, "Jewel Logo", ColorFilter.tint(Color.Magenta, BlendMode.Multiply), Modifier.size(128.dp)) | ||
} | ||
} |
Oops, something went wrong.