这是indexloc提供的服务,不要输入任何密码
Skip to content

Fix broken text field with set hint and min and max lines(#153183) #153235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Sep 26, 2024

Conversation

zeqinjie
Copy link
Contributor

@zeqinjie zeqinjie commented Aug 11, 2024

Fix #153183
Fix #52008

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide, including Features we expect every widget to implement.
  • I signed the CLA.
  • I listed at least one issue that this PR fixes in the description above.
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is test-exempt.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added a: text input Entering text in a text field or keyboard related problems framework flutter/packages/flutter repository. See also f: labels. f: material design flutter/packages/flutter/material repository. labels Aug 11, 2024
@Piinks Piinks added the team-text-input Owned by Text Input team label Aug 14, 2024
Copy link
Contributor

@LongCatIsLooong LongCatIsLooong left a comment

Choose a reason for hiding this comment

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

Looks like the feature is achievable without any flutter code changes. You can set the hintText to null when the text field becomes non-empty. Also having long hint text usually isn't great UX since it goes away as soon as you start typing.

@github-actions github-actions bot removed the a: text input Entering text in a text field or keyboard related problems label Aug 26, 2024
@zeqinjie
Copy link
Contributor Author

Looks like the feature is achievable without any flutter code changes. You can set the hintText to null when the text field becomes non-empty. Also having long hint text usually isn't great UX since it goes away as soon as you start typing.

@LongCatIsLooong Thank you for your review, yes, but we need additional logic to update textField, so I added a variable to control it for the convenience of users.

Copy link
Contributor

@LongCatIsLooong LongCatIsLooong left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for bearing with me!

@@ -4505,6 +4505,21 @@ void main() {
final Text hintTextWidget = tester.widget(hintTextFinder);
expect(hintTextWidget.style!.overflow, decoration.hintStyle!.overflow);
});

testWidgets('hint should be ignore its height when input text', (WidgetTester tester) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
testWidgets('hint should be ignore its height when input text', (WidgetTester tester) async {
testWidgets('Ignore hint height on non-empty text', (WidgetTester tester) async {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dkwingsmt thank you, i update my test

duration: decoration.hintFadeDuration ?? _kHintFadeTransitionDuration,
curve: _kTransitionCurve,
child: hintTextWidget,
) : AnimatedSwitcher(
Copy link
Contributor

Choose a reason for hiding this comment

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

The animation logic seems complicated. I don't know what the expectation is here, but we probably want to test any non-trivial behavior. (Consider AnimationSheetBuilder)

Copy link
Contributor Author

@zeqinjie zeqinjie Sep 18, 2024

Choose a reason for hiding this comment

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

@dkwingsmt Sorry, I don't know much about the AnimationSheetBuilder component, so I refer to testWidgets('InputDecoration.collapsed accepts hintFadeDuration') to write tests

@zeqinjie zeqinjie requested a review from dkwingsmt September 18, 2024 10:32
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 2, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 3, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 4, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 6, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 6, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Oct 7, 2024
auto-submit bot pushed a commit to flutter/packages that referenced this pull request Oct 7, 2024
Manual roll requested by stuartmorgan@google.com

flutter/flutter@fa402c8...ead6b0d

2024-09-27 kustermann@google.com Remove left-over traces of "link-dry-run" - which isn't used anywhere in flutter (flutter/flutter#155820)
2024-09-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from e57b440ec4ee to 7c603de2dca7 (5 revisions) (flutter/flutter#155811)
2024-09-27 bruno.leroux@gmail.com Fix DropdownMenu rendered behind AppBar (flutter/flutter#155539)
2024-09-27 engine-flutter-autoroll@skia.org Roll Flutter Engine from 53517772a5b0 to e57b440ec4ee (8 revisions) (flutter/flutter#155799)
2024-09-27 ditman@gmail.com Throw StateError when implicitView is null on `wrapWithDefaultView`. (flutter/flutter#155734)
2024-09-27 34871572+gmackall@users.noreply.github.com Roll packages manually (flutter/flutter#155786)
2024-09-27 rmolivares@renzo-olivares.dev fix: SelectableText should handle focus changes (flutter/flutter#155771)
2024-09-27 34871572+gmackall@users.noreply.github.com Use flutter from in same repo (not path) in `generate_gradle_lockfiles.dart` (again) (flutter/flutter#155794)
2024-09-26 34871572+gmackall@users.noreply.github.com Use flutter from in same repo (not path) in `generate_gradle_lockfiles.dart` (flutter/flutter#155790)
2024-09-26 rmolivares@renzo-olivares.dev `RenderParagraph` should invalidate its `_SelectableFragment`s cached rects on window size updates (flutter/flutter#155719)
2024-09-26 zeqinjie@qq.com Fix broken text field with set hint and min and max lines(#153183) (flutter/flutter#153235)
2024-09-26 engine-flutter-autoroll@skia.org Roll Flutter Engine from 9e6133e8d906 to 53517772a5b0 (1 revision) (flutter/flutter#155772)
2024-09-26 ian@hixie.ch Fix line-wrapping in `flutter create` error message. (flutter/flutter#150325)
2024-09-26 christopherfujino@gmail.com remove fujino from CODEOWNERS (flutter/flutter#155369)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC camillesimon@google.com,stuartmorgan@google.com on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 11, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Dec 12, 2024
@zeqinjie zeqinjie deleted the fix_153183 branch January 4, 2025 14:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
autosubmit Merge PR when tree becomes green via auto submit App f: material design flutter/packages/flutter/material repository. framework flutter/packages/flutter repository. See also f: labels. team-text-input Owned by Text Input team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Broken text field with set hint and min and max lines Unexpected behaviour of TextField hintMaxLines property
5 participants