Skip to content

Scale input decorator label width - #59010

Merged
fluttergithubbot merged 4 commits into
flutter:masterfrom
guidezpl:input-decorator-label-scale
Jun 9, 2020
Merged

fluttergithubbot merged 4 commits into
flutter:masterfrom
guidezpl:input-decorator-label-scale

Conversation

@guidezpl

@guidezpl guidezpl commented Jun 8, 2020 •

Copy link
Copy Markdown
Member

Description

When a text field is empty and unfocused, a label will be truncated with ellipsis if it is too long.

When the text field is focused, a floating label will be scaled down by a factor of 0.75, but so is its width. This means the label doesn't use available space. This PR fixes this behavior by scaling the label width.

Before:
Screenshot 2020-06-08 at 22 07 46

After:
Screenshot 2020-06-08 at 22 07 14

Related Issues

Closes #56848

Tests

Added a test to verify that the label width scales when focused

Checklist

Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes ([x]). This will ensure a smooth and quick review process.

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Did any tests fail when you ran them? Please read Handling breaking changes.

  • No, no existing tests failed, so this is not a breaking change.
  • Yes, this is a breaking change. If not, delete the remainder of this section.

@fluttergithubbot fluttergithubbot added p: material_ui material_ui package in flutter/packages framework flutter/packages/flutter repository. See also f: labels. labels Jun 8, 2020
@guidezpl
guidezpl requested a review from justinmc June 8, 2020 20:16

@justinmc justinmc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍

I ran the branch locally and tried to break it but it seems to work in the cases I tried.

Take a look at the test that's failing, hopefully it's unrelated.

@perclasson perclasson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@fluttergithubbot
fluttergithubbot merged commit 22ea668 into flutter:master Jun 9, 2020
@guidezpl
guidezpl deleted the input-decorator-label-scale branch June 9, 2020 18:20
zljj0818 pushed a commit to zljj0818/flutter that referenced this pull request Jun 22, 2020
vasilich6107 added a commit to artflutter/whatsup_flutter_june2020 that referenced this pull request Jul 8, 2020
mingwandroid pushed a commit to mingwandroid/flutter that referenced this pull request Sep 6, 2020
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jul 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Floating label on InputDecoration is truncated even when it could fit

5 participants