Skip to content

Conversation

@HansMuller
Copy link
Contributor

@HansMuller HansMuller commented May 4, 2018

Added InputDecoration.errorMaxLines and InputDecorationTheme.errorMaxLines. The default is null, which matches the current implementation: the input decorator's errorText is '...' clipped to a single line. If errorMaxLines is a value greater than 1, the error text will wrap until errorMaxLines have been filled and then '...' clip as before.

The InputDecorator's height will grow depending on how many lines (if any) the non-null errorText occupies.

Also: changed the type of InputDecoration.contentPadding. It is now EdgeInsetsGeometry, so contentPadding values can be depend on the text direction.

Fixes: #17172

Incorporates the contentPadding change proposed by @xclud in #16329

screenshot

widget.errorText,
style: widget.errorStyle,
textAlign: widget.textAlign,
overflow: TextOverflow.ellipsis,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you also want to be able to specify the overflow here? I know that at least for Arabic, ellipsis is pretty bad as a choice (it cuts off whole words only, so often doesn't fill the available space). It's a good default, but it would be good to be able to specify it. (See #16450 also)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That seems reasonable. An alternative would be an error widget value, which would would allow one to display anything at all for the error. The implementation is already structured this way. The hardest part might be deciding what to call the property. Maybe InputDecoration.errorWidget.

If it's OK with you, I'd like to defer this bit of evolution to a separate PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure.

@gspencergoog
Copy link
Contributor

32384589-a60f0e74-c078-11e7-9bc1-e5b5287aea9d

@HansMuller HansMuller merged commit f8d0d87 into flutter:master May 4, 2018
@HansMuller HansMuller deleted the input_decorator_error_height branch May 4, 2018 20:26
cbracken added a commit that referenced this pull request May 5, 2018
@tvolkert
Copy link
Contributor

tvolkert commented May 9, 2018

This introduced a regression in text layout of the input's counter whereby the text is shifted to the left:

text-layout

We now have the capability to do golden file testing in this repo, so we should be able to add a test for this when we fix.

@tvolkert tvolkert added the c: regression It was better in the past than it is now label May 9, 2018
@tvolkert
Copy link
Contributor

tvolkert commented May 9, 2018

Per @HansMuller this is working as intended - this PR fixed the structure of the counter layout.

@tvolkert tvolkert removed the c: regression It was better in the past than it is now label May 9, 2018
DaveShuckerow pushed a commit to DaveShuckerow/flutter that referenced this pull request May 14, 2018
@axel-op
Copy link

axel-op commented Apr 6, 2019

@HansMuller Could you add a similar parameter but for helperText, which takes place at the exact same location as errorText ? Because at the moment it seems that we can make a multiline errorText under TextFields, but text given in helperText attribute is still wrapped. Maybe it is intentional?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Provide a way to specify behavior of error message on InputDecorator when it overflows

5 participants