Skip to content

Conversation

@justinmc
Copy link
Contributor

Closes #29927

TextFields currently vertically center their text when they have an outline border. The difference between this and top alignment is almost nothing in most cases except when the input is very tall (see issue). We need to decide if we need that vertically centering functionality at all, and if so, when exactly.

Currently, this PR is just an exploration of how we could force top alignment, since according to #29927 (comment), we may not need this vertical centering at all.

@justinmc justinmc self-assigned this Apr 15, 2019
@Hixie Hixie added f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. labels Apr 16, 2019
@justinmc
Copy link
Contributor Author

@HansMuller I need your advice on this.

Someone opened an issue (#29927) because tall text fields with an outline vertically center the text:

But without an outline it's aligned to the top:

I think this was on purpose originally, but the material spec may have since changed, because Will is saying that all multiline inputs should be aligned to the top: #29927 (comment)

There are several things we could do here, from providing param(s) to allow the user to set the vertical alignment, to getting rid of vertical centering altogether. What do you think?

@HansMuller
Copy link
Contributor

@justinmc I don't think it would be a good idea to change the default layout of (multiline) outlined textfields however I agree that the aligning the text to the top makes more visual sense. The safest path would be to introduce a parameter that does the job. It might be useful to define this new parameter in a way that allows for bottom-alignment, or arbitrary vertical alignment.

@justinmc
Copy link
Contributor Author

justinmc commented Apr 18, 2019

After discussing this, I am going to investigate providing a new parameter that specifies the vertical alignment as a range, with top, center, and bottom constants.

@justinmc
Copy link
Contributor Author

Note to self: make sure that the solution here considers the alignLabelWithHint param. See #18081 (comment).

@justinmc justinmc force-pushed the text-field-vertical-align branch 4 times, most recently from a20348e to 654e8e6 Compare June 6, 2019 22:59
@justinmc justinmc force-pushed the text-field-vertical-align branch from 8b2f48c to 33df0c5 Compare June 11, 2019 23:18
@justinmc justinmc closed this Jun 12, 2019
@justinmc justinmc force-pushed the text-field-vertical-align branch from 33df0c5 to 25c8400 Compare June 12, 2019 20:27
@justinmc
Copy link
Contributor Author

I just messed this PR up badly somehow... It is not merged into master. I will try to recover my code and open a new PR.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Textfield text is centered vertically when expands = true and using an OutlineInputBorder

4 participants