Kotlin / Storytale

Apache License 2.0
184 stars 4 forks source link

TextFieldColors does not work #23

Open pspmoe opened 1 month ago

pspmoe commented 1 month ago

The same Compose widget displays differently in Compose Desktop and Storytale:

// Compose Desktop
fun main() = application {
    Window(
        onCloseRequest = ::exitApplication,
        title = "Example"
    ) {
        TextField(
            value = "ABCDEFG",
            onValueChange = {},
            isError = true,
            supportingText = { Text("This is a supporting text!") }
        )
    }
}

Display: image

// Storytale
val `TextField Story` by story {
    TextField(
        value = "ABCDEFG",
        onValueChange = {},
        isError = true,
        supportingText = { Text("This is a supporting text!") }
    )
}

Display: image

The SupportingText colors of the two are different. The expected color is red, but the actual color is black.

Also, specifying TextFieldDefaults.colors() in the TextField has no effect either, all colors remain as they are.

whitescent commented 1 month ago

Thank you for the report, this is because Storytale currently uses a separate Theme for the Gallery App, but does not apply the MaterialTheme to the story component

pspmoe commented 1 month ago

Thank you for the report, this is because Storytale currently uses a separate Theme for the Gallery App, but does not apply the MaterialTheme to the story component

Explicitly specifying the colors doesn't work either, is this for the same reason?

fun main() = application {
    Window(
        onCloseRequest = ::exitApplication,
        title = "Example"
    ) {
        TextField(
            value = "ABCDEFG",
            onValueChange = {},
            colors = TextFieldDefaults.colors(
                focusedTextColor = Color.Red,
                unfocusedTextColor = Color.Red
            )
        )
    }
}

Display: image

val `TextField Story` by story {
    TextField(
        value = "ABCDEFG",
        onValueChange = {},
        colors = TextFieldDefaults.colors(
            focusedTextColor = Color.Red,
            unfocusedTextColor = Color.Red
        )
    )
}

Display: image