-
Notifications
You must be signed in to change notification settings - Fork 29.3k
Keyboard scrolling of Scrollable #45019
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
Conversation
Looks like cirrus is unhappy :( |
0cf9a29
to
5add30c
Compare
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.
Can you add more tests to ensure that it scrolls in the right direction when "reverse: true" and when a "center" sliver is used?
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.
OK, I added some, which highlighted that I needed to change how I specified direction, so it's now an Axis
and a reverse
bool instead of an AxisDirection
, so it can be resolved with the current directional environment.
What do you mean by "center sliver"? I'm not sure what that should look like.
988ba7f
to
28c9bb9
Compare
28c9bb9
to
e35888e
Compare
I've cleaned this up so that there isn't a new public API on |
@goderbauer, can you respond to my comment so I can address yours? |
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, would defer to @goderbauer on the requested test though
302bfbf
to
9e90aaa
Compare
Hi, @goderbauer, OK, I think I added the sliver test that we talked about. Please take a look. |
9e90aaa
to
ed6f02b
Compare
Cirrus looks unhappy. |
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.
That each line gets its own if
reads awkward...
I wonder if this would look nicer with just one if and then the spread operator? Not sure, though.
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.
Yes, it does! Done.
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.
nit: link to the issue for this?
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.
Done.
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.
Nice explanation!
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.
Does this sentence have a duplicated verb? "..is really refers to..." sounds strange...
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.
Removed "is really" (and yes, it was a typo).
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 really refers to..." ?
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.
Fixed.
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.
nit: first paragraph should be a one-sentence summary. Move the second sentence to a separate paragraph?
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.
Done.
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's not really clear to me from the doc why we have this property and what it actually means....
Also, what is the "natural scroll direction"? Is that what apple calls natural scrolling? Are we making up our own definition?
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.
Don't you need an AxisDirection? e.g. wether to scroll up or down?
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.
Oh, is that supposed to be indicated by the reversed property?
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 switched back to AxisDirection
and made sure it worked. I never did discover what made me switch away from it in the first place: maybe an old design was flawed? I also did add a test for RTL locales to make sure that the result was correct there too.
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.
Hm, this seems odd. It has NeverScrollableScrollPhysics, but you can still scroll it with the keyboard? That sounds like a bug?
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.
Yep, it was. I added a test for this, and fixed the bug.
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.
Instead of making the test based on scrolloffsets (which are difficult to comprehend since the zero scroll offset may be at the top or bottom) maybe use multiple slivers with text (e.g. sliver 1, sliver 2, etc). and then assert that the expected slivers are currently visible?
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.
Done. All based on the rects of the items now.
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.
OK, @goderbauer, I think I addressed everything we talked about. PTAL.
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.
Yes, it does! Done.
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.
Done.
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.
Removed "is really" (and yes, it was a typo).
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.
Fixed.
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.
Done.
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.
Yep, it was. I added a test for this, and fixed the bug.
5ef40bd
to
ed91145
Compare
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
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.
SHould there be one last expect on the rect to ensure that Box 0 is back to where it started?
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.
same here.
ed91145
to
093509b
Compare
Description
This adds the ability to scroll and page up/down in a
Scrollable
using the keyboard. Currently, the macOS bindings usePlatform.isMacOS
as a check, but we'll switch that to bedefaultTargetPlatform == TargetPlatform.macOS
once that exists.Related Issues
Tests
Breaking Change