https://kotlinlang.org logo
#compose
Title
# compose
s

sindrenm

10/07/2020, 9:52 AM
Is there a relatively straight-forward way of removing the bottom indicator line in (filled) `TextField`s? I found
Modifier.drawIndicatorLine()
in TextField.kt but it's private. I could go ahead and make a “completely” custom text field using
BaseTextField
, I guess, it's just that
TextField
already had placeholders, leading/trailing icons and shapes and stuff built-in.
s

Se7eN

10/07/2020, 9:55 AM
Yeah I was looking for that too but couldn't find anything so ended up using
BaseTextField
m

matvei

10/07/2020, 10:09 AM
What's your usecase? Do you want to just make this bottom line transparent and have rounder corners everywhere? How far do you want to go from material specs? I want to understand usecase better so we could consider reasonable changes later on. cc @Anastasia [G]
s

sindrenm

10/07/2020, 10:11 AM
I want to end up here, essentially. Figured I could use a
TextField
and set a shape, leading icon, background and a placeholder. simple smile
s

Se7eN

10/07/2020, 10:12 AM
This is mine
s

sindrenm

10/07/2020, 10:13 AM
I see Jetchat made its own using just
BaseTextField
, it's not really a problem to go that route. Just a little more stuff to manage. 😎
m

matvei

10/07/2020, 10:28 AM
Thanks folks! The question here is how much you will be able to stretch material TextField before completely giving up 🙂 If you do real apps going down the
BaseTextField
route is more sustainable, since when you will add more features, you will hit more walls of material TextField being very opinionated about what goes where and what the animations are, etc. Anyway, if you think that just possibility of making indicator line transparent will solve your cases -- file a feature request please.
👍 2
s

Se7eN

10/07/2020, 10:33 AM
Yeah the indicator is the only reason we're forced to use
BaseTextField
in a lot of cases
s

sindrenm

10/07/2020, 10:38 AM
Yeah, the more I think about it, I think it probably makes more sense to implement our own using
BaseTextField
. Especially seeing as filled text fields in Material always has a bottom line indicator, so it wouldn't really make sense to make it optional. Thanks! simple smile
r

Robert Menke

10/07/2020, 2:26 PM
How do you make a text field focused automatically when the composable is rendered? Still haven’t figured out how to do that properly.
3 Views