-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Make the tab be at current index when there are different controllers in different groups #108753
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
|
@snat-s Looks like the analyzer is unhappy with this change. Can you take a look and fix it up? Thanks! |
|
In the "after" video it actually looks like there is a strange bounce effect when scrolling all the way to the right. Is that expected? |
It is. Since it is on an iOS emulator, the mouse pointer is being treated like a touch drag. |
I meant the bounce after the autoscroll. Not the one we see when it is actually dragged with the mouse. |
|
This is another video, it seems like the physics behave differently in group 1 and in group 2. Screen.Recording.2022-08-04.at.11.48.27.mov |
The scroll doesn't seem to scroll to the end which is a bit weird. Is that expected? |
| await tester.tap(find.text('Group 2')); | ||
| await tester.pumpAndSettle(); | ||
|
|
||
| // Now that we are in the second group drag to the end and |
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.
avoid we
| void initState() { | ||
| super.initState(); | ||
|
|
||
| for (int i = 0; i < 5; i++) { |
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 5? It looks like for this test you only need 2?
| _currentIndex = _controller!.index; | ||
|
|
||
| if (widget.isScrollable && _scrollController != null) { | ||
| _scrollToCurrentIndex(); |
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 have found why the bounce @goderbauer noticed is happening.
Screen.Recording.2022-08-17.at.3.13.35.PM.mov
It is much more noticeable if you make one of the lists of tabs much longer than the other one, shown above.
You may be missing a setState call before calling _scrollToIndex, that may be a good place to look first here. What it looks like is that:
in LongTab, the last index is say 100 pixels away.
in the shorter tab, the last index is closer, maybe 50 pixels away.
When the index changes here and you call _scrollToIndex, it is using the information from the long tab, rather than the shorter tab. This is why there is a large bounce in the video, it is trying to scroll much further than it needs to.
|
Hey @snat-s did you want to continue with this change? If not that's ok, we can close it for another contributor to look into. :) |
|
Ohh Hi! I think I am a bit occupied with Uni right now so if any other contributor could help would be better! |
|
Ok, no worries at all. Thanks! |
Added a conditional to check if there is a controller in use so that it can change to the current index of the Tabs.
Before:
149877992-29cb4812-667a-48cc-9272-06179df87d3f.mov
Now:
Screen.Recording.2022-08-01.at.15.39.23.mov
Fixes #96718
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.