how can i set values for TextFieldDefaults ? that ...
# compose-desktop
z
how can i set values for TextFieldDefaults ? that will be used everywhere. or how can i put that into my Theme ?
a
That’s an object, not a variable, so you can’t. What you can do is make your own
Copy code
@Composable
fun ZoffTextField(
    ...
    colors: TextFieldColors = ZoffsTextFieldDefaults.outlinedTextFieldColors()
) {
    TextField(
        ...
        colors = colors
    )
}
and use it everywhere in your app.
z
ok. there nothing in Theme {} do set those somehow? does textfield not take stuff from Theme?
a
Not sizes
z
i dont care so much about size. but just the forground and background colors. it looks bad when everything has grey BG and only the textinputs have bright white BG
would be cool if i could set that somehow globally for all textinputs
a
Sorry, not just sizes, but everything in the
TextFieldDefaults
object.
Well, actually, some are taken from the theme
Look at the source code of, e.g.
TextFieldDefaults.outlinedTextFieldColors
Looks like sizes are hardcoded, but colors are all taken from the theme.
z
ah cool. i will check that