Skip to content

Solve the problem when a textField sets inputFormatters #69553

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

Closed
wants to merge 1 commit into from

Conversation

Shadow-NewBee
Copy link

@Shadow-NewBee Shadow-NewBee commented Nov 2, 2020

Description

Solve the problem when a textField sets inputFormatters such as FilteringTextInputFormatter.allow(RegExp('[a-zA-Z0-9]')), then user input word with Chinese Pinyin Keyboard, the composing letters will be formate. The problem show in Rateted Issue, there is a gif.

Related Issues

edit_textField

Tests

I added the following tests:

Checklist

  • 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

  • No, no existing tests failed, so this is not a breaking change.

Sorry, something went wrong.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@flutter-dashboard flutter-dashboard bot added the framework flutter/packages/flutter repository. See also f: labels. label Nov 2, 2020
@google-cla google-cla bot added the cla: yes label Nov 2, 2020
@LongCatIsLooong
Copy link
Contributor

LongCatIsLooong commented Nov 2, 2020

Hi @Shadow-NewBee thanks for the PR! For this PR to be reviewed/submitted you must provide tests to guard against future regressions (instructions can be found here: https://github.com/flutter/flutter/wiki/Running-and-writing-tests). Also we should probably not prevent all TextInputFormatters from formatting the text while text composition is in progress.

@LongCatIsLooong LongCatIsLooong added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Nov 6, 2020
@goderbauer
Copy link
Member

@Shadow-NewBee Do you have plans to follow up soon-ish on the feedback provided above?

@Shadow-NewBee
Copy link
Author

@Shadow-NewBee Do you have plans to follow up soon-ish on the feedback provided above?

Yeah, But I had trouble to make test, in addition, some default checks such as Mac framework_tests showed failed, but I do not how to fix it.
I Need help. Do you have any suggestions?
Thanks.

@AlexV525
Copy link
Member

@Shadow-NewBee Thanks for the contribution! I was wondering if this fix can directly lands on the formatter.

@AlexV525
Copy link
Member

Also you need to update the checklist if you can follow up the feedback

@AlexV525
Copy link
Member

This behavior breaks some tests so the framework tests failed.

One of the failing test's log:

00:28 +798 ~2: /opt/s/w/ir/k/flutter/packages/flutter/test/widgets/editable_text_test.dart: formatter logic handles repeat filtering                                                                   
══╡ EXCEPTION CAUGHT BY FLUTTER TEST FRAMEWORK ╞════════════════════════════════════════════════════
The following TestFailure object was thrown running a test:
  Expected: <4>
  Actual: <3>

When the exception was thrown, this was the stack:
#4      main.<anonymous closure> (file:///opt/s/w/ir/k/flutter/packages/flutter/test/widgets/editable_text_test.dart:5627:5)
<asynchronous suspension>
<asynchronous suspension>
(elided one frame from package:stack_trace)
...

This was caught by the test expectation on the following line:
  file:///opt/s/w/ir/k/flutter/packages/flutter/test/widgets/editable_text_test.dart line 5627
The test description was:
  formatter logic handles repeat filtering
════════════════════════════════════════════════════════════════════════════════════════════════════

@flutter-dashboard
Copy link

This pull request executed golden file tests, but it has not been updated in a while (20+ days). Test results from Gold expire after as many days, so this pull request will need to be updated with a fresh commit in order to get results from Gold.For more guidance, visit Writing a golden file test for package:flutter.

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@goderbauer
Copy link
Member

I am going to close this one for now. If you have time to address the feedback feel free to re-open.

@goderbauer goderbauer closed this Dec 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
framework flutter/packages/flutter repository. See also f: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants