-
Notifications
You must be signed in to change notification settings - Fork 29.1k
Make textfields restorable #63401
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
Make textfields restorable #63401
Conversation
Tests will fail until #63131 is merged and this PR is rebased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM besides a small naming typo in my comment below. I'm really excited for the ability to restore text fields, thanks for doing this!
I also wanted to make sure that you've thought about TextFormField as well. It just renders a TextField, so it should pick up all of the restoration logic here, but what about say its validation state? If a TextFormField is invalid and displaying an error, and then later it is restored, will it still be showing the validation error message? Maybe that's a separate issue.
} | ||
|
||
Future<void> skipPastScrollingAnimation(WidgetTester tester) async { | ||
await tester.pump(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this pump necessary even with the duration pump on the next line?
Same question for the material text field test.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need one pump to start the animation. And another (with a duration) to finish it.
@@ -0,0 +1,125 @@ | |||
// Copyright 2014 The Flutter Authors. All rights reserved. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The name of this file is missing an underscore, should be "text_field_restoration_test".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed.
I've not looked at that one yet, but added it to the backlog in #62916. |
5230870
to
30de545
Compare
30de545
to
dafcb3c
Compare
Description
Enabled the TextField widgets (Material's
TextField
,CupertinoTextField
) to restore their scroll offset and their text content with the state restoration framework.This PR requires #63131 to land first.
Related Issues
#62916
Tests
I added the following tests:
TextField
andCupertinoTextField
.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.///
).flutter analyze --flutter-repo
) does not report any problems on my PR.Breaking Change
Did any tests fail when you ran them? Please read Handling breaking changes.