https://kotlinlang.org
Join Slack
Is there an easy way to center a composable inside a `Card` ? :sweat_smile: Card has fixed size, and...
y

yahyabayramoglu

over 4 years ago
Is there an easy way to center a composable inside a
Card
? šŸ˜… Card has fixed size, and it only contains a Text which needs to be centered. This is literally the only way I could get it work - I must be doing something wrong here šŸ™‚
Card(modifier = Modifier.size(50.dp).padding(4.dp)) {
    Row(verticalAlignment = Alignment.CenterVertically) {
          Text(
                text = "10",
                textAlign = TextAlign.Center,
                fontSize = 10.sp,
                modifier = Modifier.fillMaxWidth()
           )
     }
}
y
m
l
  • 3
  • 4
  • 734
Is it possible to store the raw Sql statements Exposed passes to the DB in a variable? I'm aware log...
e

Eric Thomas

over 2 years ago
Is it possible to store the raw Sql statements Exposed passes to the DB in a variable? I'm aware logging the statements via
addLogger(StdOutSqlLogger)
but how can I access/interact with this info? ex:
Exposed: transaction { table.select { table.id eq 123 } }
Raw SQL ran against DB: SELECT * FROM TABLE WHERE ID = 123;

//desired result
val executedSql = SELECT * FROM TABLE WHERE ID = 123;
println(executedSql)
How can I access the raw sql executed against the DB?
e
a
  • 2
  • 6
  • 733
Hello, I'm seeing this error: ```io.ktor.serialization.JsonConvertException: Illegal input Caused by...
c

CLOVIS

about 2 years ago
Hello, I'm seeing this error:
io.ktor.serialization.JsonConvertException: Illegal input
Caused by: io.ktor.serialization.JsonConvertException: Illegal input
Caused by: kotlinx.serialization.json.internal.JsonDecodingException: Polymorphic serializer was not found for missing class discriminator ('null')
JSON input: {"failures":[{"type":"INCOMPATIBLE_FIELD","field":"","message":"impossible d'importer class opensavvy.formulaide.core.Field$Label Ć  partir de class opensavvy.formulaide.core.Field$Group"}]}
Pretty-printing the JSON on the last line:
{
	"failures": [
		{
			"type": "INCOMPATIBLE_FIELD",
			"field": "",
			"message": "impossible d'importer class opensavvy.formulaide.core.Field$Label Ć  partir de class opensavvy.formulaide.core.Field$Group"
		}
	]
}
It looks normal to me, and there definitely is a type discriminator? What's going on?
c
i
  • 2
  • 1
  • 732
How do you handle validation in the primary constructor? In vanilla Kotlin, it's idiomatic to write...
c

CLOVIS

over 2 years ago
How do you handle validation in the primary constructor? In vanilla Kotlin, it's idiomatic to write
value class Password(val text: String) {
    init {
        require(text.length > 8) { "A password should have at least 8 characters, found ${text.length}" }
    }   
}
I know about
ensure
& co, however the primary constructor cannot return
Either
, so how do you recommend exposing validation? I guess another pattern could be to provide a factory method?
fun String.asPassword() = Either.catch { Password(this@asPassword) }
c
s
+2
  • 4
  • 27
  • 732
`toRadians` and `toDegrees`. Both are present in `java.lang.Math` but for MP it's a problem
e

elect

almost 3 years ago
toRadians
and
toDegrees
. Both are present in
java.lang.Math
but for MP it's a problem
e
k
+3
  • 5
  • 17
  • 732
Hello..... how i resolve this error "com.google.firebase.auth.FirebaseAuthException: This request is...
p

Pisco

about 2 years ago
Hello..... how i resolve this error "com.google.firebase.auth.FirebaseAuthException: This request is missing a valid app identifier, meaning that Play Integrity checks, and reCAPTCHA checks were unsuccessful"
not kotlin but kotlin colored 4
p
i
  • 2
  • 2
  • 731
Hi there. I have a question - is it possible to change white background of the ComposeUIViewControll...
ł

Łukasz Zieliński

about 2 years ago
Hi there. I have a question - is it possible to change white background of the ComposeUIViewController to transparent? We can overlay Swift views over compose even with alpha, but the other way round seems impossible.
ł
i
+5
  • 7
  • 46
  • 730
I’m having a bit of trouble with the gradle shadow plugin `com.github.johnrengelman.shadow` I’m try...
c

Carter

over 4 years ago
I’m having a bit of trouble with the gradle shadow plugin
com.github.johnrengelman.shadow
I’m trying to create a fat JAR from various kotlin modules and my attempts to exclude transitive dependencies don’t seem to be working. My output JAR is truly fat at 820mb. I’ve tried doing this, which is what I think I need:
dependencies {
    implementation(project(":brainLib")) {
        transitive = false
    }
}
But I get the error:
Could not determine the dependencies of task ':brainLib:compileKotlinJvm'.
> Could not resolve all dependencies for configuration ':brainLib:jvmCompileClasspath'.
  > Cannot change dependencies of dependency configuration ':brainLib:commonMainApi' after it has been included in dependency resolution.
I also tried this, which is supposed to be like a ā€œkeepā€ rule in proguard, but that didn’t work either. (I think because the huge dependencies are transitive under brainLib).
shadowJar {
    minimize {
        exclude(project(":brainLib"))
    }
}
Are there other suggestions as to what I could try?
c
t
  • 2
  • 21
  • 729
Has anyone used `contentType` in `LazyColumn` ? I’m trying to implement a multi type List, but I’m ...
m

Mohammad Sianaki

over 3 years ago
Has anyone used
contentType
in
LazyColumn
? I’m trying to implement a multi type List, but I’m facing serious performance issue
m
m
s
  • 3
  • 5
  • 728
Can Kover be applied to Android Connected/Instrumented UI tests?
d

darkmoon_uk

about 3 years ago
Can Kover be applied to Android Connected/Instrumented UI tests?
plus one 1
d
s
+2
  • 4
  • 6
  • 727
Previous666768Next

kotlinlang

A modern programming language that makes developers happier.

Powered by