nglauber
06/01/2021, 8:28 PMTextField
without implement it from BasicTextView
?
Or have this “LineTextField” + everything from “Material Design TextField” (label, leading icon, trailing icon, …)?iamthevoid
06/01/2021, 9:46 PMplaceholder
visible when input not focused?nglauber
06/01/2021, 9:49 PMnglauber
06/01/2021, 9:49 PMTextField
, I just set the background color as transparent…iamthevoid
06/02/2021, 4:40 AMnglauber
06/02/2021, 4:54 PMLayout
but it’s not working on all cases… 😞Colton Idle
06/02/2021, 4:54 PMColton Idle
06/02/2021, 4:55 PMLouis Pullen-Freilich [G]
06/02/2021, 4:57 PMnglauber
06/02/2021, 5:00 PMLayout
and it works for a few cases (width as fillMaxWidth or static value)… but not working when I’m using weight
modifier…nglauber
06/02/2021, 5:00 PMLouis Pullen-Freilich [G]
06/02/2021, 5:01 PMweight
?nglauber
06/02/2021, 5:02 PMTextField
width and use a negative offsetnglauber
06/02/2021, 5:03 PMnglauber
06/02/2021, 7:15 PMLouis Pullen-Freilich [G]
06/02/2021, 7:16 PMweight
?Colton Idle
06/02/2021, 7:16 PMColton Idle
06/02/2021, 7:18 PMnglauber
06/02/2021, 7:18 PMfillMaxWidth
or weight
is set. But doesn’t work when a static width is set.Colton Idle
06/02/2021, 7:19 PMTheLegacy would be super helpful in compose!supports 4 different appearance variants which can be set via themat-form-field
input. Theappearance
appearance is the default style that thelegacy
has traditionally had. It shows the input box with an underline underneath it. Themat-form-field
appearance is a slightly updated version of thestandard
appearance that has spacing that is more consistent with thelegacy
andfill
appearances. Theoutline
appearance displays the form field with a filled background box in addition to the underline. Finally thefill
appearance shows the form field with a border all the way around, not just an underline.outline
nglauber
06/02/2021, 7:20 PMLouis Pullen-Freilich [G]
06/02/2021, 7:20 PMconstraints.copy(
maxWidth = constraints.maxWidth + textFieldGap
)
And you are measuring it with more space than you actually havenglauber
06/02/2021, 7:21 PMnglauber
06/02/2021, 7:22 PMColton Idle
06/02/2021, 7:23 PMKinda… To summarize, I want everything from the “Filled” TextField from Material design, less the margin and background.Yeah. Sounds like you are doing the same thing my team is trying to do. Our design team wants the "filled" input fields, with no background color and no padding so that it appears like the standard/legacy approach. I could not find a good solution. So far we are setting no background and the design team just decided to keep the padding. 🤮
Louis Pullen-Freilich [G]
06/02/2021, 7:24 PMTextField
isn’t really designed to be manipulated in this way 🙂
If you really want to deviate, it’s probably just going to be easier to build your own, even though that is a lot of work right nownglauber
06/02/2021, 7:26 PMColton Idle
06/02/2021, 7:26 PMAndroidView
composable and just call it a day...?nglauber
06/02/2021, 7:28 PMnglauber
06/02/2021, 7:29 PMColton Idle
06/02/2021, 7:31 PMLouis Pullen-Freilich [G]
06/02/2021, 7:39 PMand everybody will be happy and stop asking “how to remove the extra padding from TextField”If only it was that simple 🙂 We already have received multiple requests for other features: • Text alignment • padding customization for other things in a text field, such as leading / trailing icons • Indicator width / size customization • Height customization for the text field • Changes to label / placeholder behavior It’s not really fair to say that just exposing padding will make this text field fit every use case - if anything it just raises more questions as to what should / shouldn’t be exposed.
TextField
is an implementation of the Material Specification for text fields - if this doesn’t meet your design specification then that is unfortunate, but this isn’t a separate problem space for any other custom components. If you want a button that doesn’t look like a Material Button
, then you can just build your own - the same is true for a text field that doesn’t fit the spec (it just so happens that TextField
is very complex compared to other components, so there is more to implement / copy and paste).
In the future we might be able to provide some building blocks that make it easier to build a Material-like text field, but at least for now there are no plans to expose this sort of customization on the existing APIs.Louis Pullen-Freilich [G]
06/02/2021, 7:42 PMworth filing a feature request to support a legacy input fieldThe Compose Material library is an implementation of the current Material spec, so if these components aren’t part of the current spec, then they don’t really belong in the library. Other things such as color theming will also vary between versions, so it would be very challenging to try and create consistent components here anyway 🙂
nglauber
06/03/2021, 2:56 PM