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
Implement customizable cursor height #61714
Implement customizable cursor height #61714
Conversation
Gold has detected about 4 untriaged digest(s) on patchset 6. |
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, just take a look at using pumpAndSettle as mentioned in a comment. Thanks for working on this!
@@ -625,6 +629,9 @@ class CupertinoTextField extends StatefulWidget { | |||
properties.add(DiagnosticsProperty<bool>('expands', expands, defaultValue: false)); | |||
properties.add(IntProperty('maxLength', maxLength, defaultValue: null)); | |||
properties.add(FlagProperty('maxLengthEnforced', value: maxLengthEnforced, ifTrue: 'max length enforced')); | |||
properties.add(DoubleProperty('cursorWidth', cursorWidth, defaultValue: 2.0)); | |||
properties.add(DoubleProperty('cursorHeight', cursorHeight, defaultValue: null)); | |||
properties.add(DiagnosticsProperty<Radius>('cursorRadius', cursorRadius, defaultValue: null)); |
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 adding these missing properties!
tester.state<EditableTextState>(textFinder).showToolbar(); | ||
await tester.pump(); | ||
await tester.pump(const Duration(milliseconds: 500)); | ||
await tester.pump(const Duration(milliseconds: 500)); |
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.
You should be able to use a pumpAndSettle here and below instead of the multiple pumps and durations, if you haven't tried it already.
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.
I could only replace one, I think it has to do with the cursor blinking and the timing needing to be right
await tester.tap(find.text('Paste')); | ||
await tester.pump(); | ||
await tester.pump(const Duration(milliseconds: 500)); | ||
await tester.pump(const Duration(milliseconds: 500)); |
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.
Strange, is the pump
without a duration needed as well? And what if you combine the two with durations into one with Duration(seconds: 1)
?
There are other tests that do this sort of thing, though not testing the cursor size.
Anyway I think the main thing is to just make sure it's clear to someone else reading this code why the pumps are there, so maybe just add a comment.
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.
It wasn't, I simplified this test and others doing the same thing, and added a comment
Description
Cursor width can currently be customized. This PR adds the ability to customize cursor height for Cupertino and Material text fields (as well as
EditableText
andSelectableText
).Related Issues
Closes #26870
#61715
Tests
I added the following tests:
debugFillProperties
and plumbing testsChecklist
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.