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
// implementation("org.apache.xmlgraphics:batik-all:1.13") | |
// and load svg from resources/svg/pic.svg | |
// use like Icon(asset = svgAsset("svg/play-button.svg"), modifier = Modifier.width(36.dp) + Modifier.height(36.dp)) | |
import androidx.compose.ui.graphics.ImageAsset | |
import androidx.compose.ui.graphics.asImageAsset | |
import org.apache.batik.transcoder.TranscoderInput | |
import org.apache.batik.transcoder.TranscoderOutput | |
import org.apache.batik.transcoder.image.PNGTranscoder | |
import org.jetbrains.skija.Image | |
import java.io.ByteArrayOutputStream |
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
package io.resound.ui.components | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.border | |
import androidx.compose.foundation.layout.* | |
import androidx.compose.material.Text | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Alignment | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.graphics.Color |
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
package components | |
import androidx.compose.foundation.background | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.material.Text | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Alignment | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.graphics.Color |
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
@OptIn(ExperimentalComposeUiApi::class) | |
@Composable | |
fun Input( | |
value: TextFieldValue, | |
onValueChange: (TextFieldValue) -> Unit, | |
modifier: Modifier = Modifier, | |
placeholder: String? = null, | |
enabled: Boolean = true, | |
singleLine: Boolean = true, | |
onFocusChanged: (Boolean) -> Unit = {}, |
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
package com.github.gismenu.ui.components | |
import androidx.compose.animation.animateContentSize | |
import androidx.compose.animation.core.animateIntAsState | |
import androidx.compose.foundation.gestures.detectHorizontalDragGestures | |
import androidx.compose.foundation.layout.Box | |
import androidx.compose.foundation.layout.fillMaxSize | |
import androidx.compose.foundation.layout.offset | |
import androidx.compose.runtime.* | |
import androidx.compose.ui.Modifier |
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
@Composable fun Example() { | |
val colors = remember { listOf<Color>(Color.Blue, Color.Gray, Color.Green, Color.Magenta, Color.Yellow, Color.Cyan) } | |
val scope = rememberCoroutineScope() | |
val scaffoldState = rememberBottomSheetScaffoldState() | |
BottomSheetScaffold( | |
sheetContent = { | |
Box( | |
Modifier.fillMaxWidth().height(128.dp), | |
contentAlignment = Alignment.Center | |
) { |
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
package cargo | |
import androidx.compose.foundation.Image | |
import androidx.compose.foundation.border | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.fillMaxHeight | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.foundation.layout.width | |
import androidx.compose.material.Text | |
import androidx.compose.runtime.Composable |
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
import androidx.compose.ui.graphics.Color | |
import androidx.compose.ui.graphics.toArgb | |
import platform.UIKit.UIColor | |
fun Color.toUIColor(): UIColor { | |
val argb = this.toArgb() | |
val blue = argb and 0xff; | |
val green = argb shr 8 and 0xff; | |
val red = argb shr 16 and 0xff; |
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
package cargo | |
import androidx.compose.foundation.layout.Column | |
import androidx.compose.foundation.layout.fillMaxWidth | |
import androidx.compose.material.Text | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Modifier | |
// Exception in thread "main" java.lang.NullPointerException: Parameter specified as non-null is null: | |
// method cargo.ComponentScopeImpl.Child, parameter modifier |
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
import androidx.compose.ui.graphics.Color | |
import androidx.compose.ui.graphics.toArgb | |
import io.ktor.util.* | |
import kotlin.math.roundToInt | |
import kotlin.test.DefaultAsserter.assertEquals | |
import kotlin.test.Test | |
class UtilsKtTest { | |
private val dataSet = listOf( |