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
Interactable ScrollView content when settling a scroll activity #145848
base: master
Are you sure you want to change the base?
Conversation
…ils then i'll wait...
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.
Hey @Michal-MK it looks like this is still a draft, so I'll wait for your say so when it's ready for review. :)
@Piinks Yeah, I am sort of stuck as I reverted all the meaningful changes and the tests are still failing (other than analyze, that one I expect to fail) looking at the output widget_tester_test is something I did not touch so I assume something else is going on? Or the: I'll continue after Easter :) EDIT: Ok seeing as other PRs have functioning tests I'll comment out everything and try that. |
The three failing checks are in the FlutterGallery in the Style->Colors section. The issue there is the use of |
Interesting, I tried using a trackpad to reproduce this at https://flutter-gallery-archive.web.app/#/demo/colors but did not see an error from the scrollbar. Do you know how this change could have caused it? I think this can be fixed by making the vertical scroll views in the tab bar view not use the primary scroll controller. This would be unrelated to TabBarView, since the list of colors is separate. |
It happens on master without any changes, may be limited to MacOS then? Here is a video Screen.Recording.2024-04-04.at.17.13.37.mp4 |
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.
Little bit more digging...
I think there are duplicates of this issue:
- iOS tap status bar to scroll up doesn't work with CustomScrollView #92119
- Scrollable widget has an opaque hitTestBehavior and won't give widgets under it a chance to catch hits #146401
- and
BouncingScrollPhysics
Capturing all input until settled #145330
And there are currently two different proposals out to resolve them:
I'll try altering the Gallery then, I was not sure if that was allowed :) With that I'll see what else needs changing to make this a proper PR. |
Alright, with the explicit So I'll do some cleanup and write tests tomorrow. Then I'll change it from a Draft to a normal PR. |
- setIgnorePointer in setPixels as now there is a direct relation to it
@Piinks It seems I hit another block, this time customer tests are failing.
Those are not part of the repository as far as I know. |
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 looks like a legitimate test failure from the customer.
It lives here:
https://github.com/superlistapp/super_editor/blob/661ecb84b4f79bd3f81c1bfd148b36ab7be6993b/super_editor/test/super_editor/supereditor_scrolling_test.dart#L473
When the user taps on a scrolling viewport, the scrolling should halt. This change in behavior would be a breaking change.
I wonder if that is why some of the tests here have changed warnIfMissed
? That's also something to look at. Why did those tests change?
There are some options here, either
- the PR can be changed to fix a bug it may have introduced here
- or the PR can be changed to make this behavior an opt-in, so folks relying on the prior behavior can continue to work
- or if the customer test is capturing a bug, that this PR is fixing, we can work with the customer to transition them to the solution without breaking them. (This PR would land after the customer has been fixed)
@@ -78,7 +78,7 @@ class ColorItem extends StatelessWidget { | |||
} | |||
} | |||
|
|||
class PaletteTabView extends StatelessWidget { | |||
class PaletteTabView extends StatefulWidget { |
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.
Since this is currently broken at head, and not related to this change, this should probably be broken out into a separate PR and validated with a test so it does regress in the future.
@@ -2424,7 +2424,8 @@ void main() { | |||
expect(tester.getCenter(find.text('Item 49')).dy, equals(585.0)); | |||
|
|||
// Overscroll, dragging like this will release with 0 velocity. | |||
await tester.drag(find.text('Item 49'), const Offset(0.0, -50.0)); | |||
// , warnIfMissed: false | |||
await tester.drag(find.text('Item 49'), const Offset(0.0, -50.0), warnIfMissed: false); |
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.
Are these tests broken?
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 am working on these, even if the drag "misses", the scrollable is dragged as expected which is validated by the expect
below. I added the warnIfMissed
early in the PR, so it may not be necessary now.
@@ -323,6 +323,10 @@ class _PagePosition extends ScrollPositionWithSingleContext implements PageMetri | |||
// for use when resizing the viewport to non-zero next time. | |||
double? _cachedPage; | |||
|
|||
/// When page view goes ballistic we want to allow interaction with the page | |||
@override | |||
bool? get preferredBallisticIgnorePointer => false; |
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.
Why only PageView?
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 property preferredBallisticIgnorePointer
is still a proof of concept, right now I am trying to make all tests pass and achieve the behavior I want. Then I'll add tests and refactor it. Here the false
essentially mimics trackpad scrolling as that evaluates to false
all the time. So for now I just slapped in a false
as the preference which makes it behave like a trackpad. But with touch gestures.
/// Some ballistic activities may want to allow input on child widgets. | ||
/// This flag takes precedence over [ScrollActivity.shouldIgnorePointer] when | ||
/// starting a ballistic activity. | ||
bool? get preferredBallisticIgnorePointer; |
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.
What does it mean when this is null? It looks like some scroll positions have an opinion for this and some don't. Is this only relevant with PageView? If so, why?
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.
Currently it is only set in PageView
because I have not looked at other scrollables. That is something I want to address once the core is working. I can easily test it with PageView
for now :)
Thanks for the link, I looked at it and from local testing it seems that my current code pumps one extra frame when tapping on a scrollable. In my sample app tap to stop works so I will have to figure out what it up with that test and why my changes break it. |
@Piinks I got the customer tests working somehow :D And I managed to remove the changes to the nested_scroll_view and remove one extra With that there are a couple of things that need doing:
|
I hacked together a simple page view using Chat GPT in Kotlin and the same janky behavior is present there as well. So... what now? From a UX point of view it is horrible, but it is consistent with the native behavior. |
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 hacked together a simple page view using Chat GPT in Kotlin and the same janky behavior is present there as well. So... what now? From a UX point of view it is horrible, but it is consistent with the native behavior.
I am not sure I understand, what is the question? :)
2024-04-18.16-15-00.mp4That the native world has the same issue, so is it then an issue? Should I bother fixing it here if it may be intended? |
@Piinks How about I remove the code related to the PageView functionality for now, that way we do not need to care about the Colors Gallery issue and at least get the out of bounds scrolling interactivity merged, since that is what I wrote tests for. I think that this functionality is ready. I will create a separate issue with the PageView with the videos from here and another one for the GalleryApp Colors trackpad bug. So we can track it separately and not clutter this one? |
I am not sure what that would look like? I have not done a thorough review as you've told me a couple times it is not ready or just a proof of concept. The gallery issue is not specific to this change and needs to be fixed anyways. As far as the changes this PR is making, I would rather we sort out the intended behavior before merging any partial fix. We typically do not land partial fixes, or changes where we don't quite know what the behavior should be. |
@Piinks "As far as the changes this PR is making, I would rather we sort out the intended behavior before merging any partial fix. We typically do not land partial fixes, or changes where we don't quite know what the behavior should be." |
Hi @Michal-MK, I've reread the comments above a couple of times, and I apologize I do not understand the state of the proposal. It sounds like some of it works, some of it does not and some of it is matching native behavior. Can you help me understand, from your last comment, if you remove the PageView changes, what problem is this PR solving? What I meant by partial fix was that it sounded like this would only apply to some scrollable classes rather than all of them. |
@Piinks Sure, when we remove the 2024-03-27.19-45-59.mp42024-03-27.19-46-46.mp4native.mp4These are the relevant videos. The changes are only in scroll_activty.dart, scroll_position.dart and scroll_position_with_single_context.dart. Then classes that extend/implement these need to now have |
Currently when the user:
DrivenScrollActivity
All inputs are discarded or forwarded directly to the Scrollable widget (scroll activity).
This leads to situations like these:
2024-03-27.19-45-59.mp4
2024-03-27.19-46-19.mp4
2024-03-27.19-46-46.mp4
Which leads to poor experience on iOS. The native behavior of iOS is to allow touches while a scrollable is settling:
native.mp4
This PR alters the
shouldIgnoreTouches
ofBallisticScrollAvtivity
andDrivenScrollActivity
to not make the child of the scrollable ignore touches.Fixes #145330
Pre-launch Checklist
///
).Currently tests that test tap to stop are not working as the taps now register when they should not. Because there is no distinction between flings inside and flings that go out of range.