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
Laggy swiping between tabs #5
Comments
And also I forgot to mention another interesting thing, when I set cache_extent=8 (app. half of tabs) very interesting is that swiping between first 8 tabs is laggy while is smooth for the rest of the tabs(7 tabs). All tests were in release mode. Plugin version: 0.2.2, Flutter version 1.7 |
cacheExtent full meaning : /// {@template flutter.rendering.viewport.cacheExtent} you cache so many page , so when you tap on one , cache pages will all rebuild |
I understand concept of cache extent but thats not whats happening here.. Please read my issue one more time. Tap on Tab is not a problem in any case, whether cache_extent is equal to 2 or 15. The problem is that when I set cache_extent to be 1 or 2 and when I do SWIPING(sliding with finger to another Tab in ExtendedTabBarView) it has an annoying frame skip at the end of transition between tabs. Here is a video link, it's really hard to see in video, but on real device is really noticeable Below is my code for ExtendedTabBar and also for tabs. |
|
|
|
Hi there. You can try add logs when |
Hey guys, I've found out what is the problem. Let's say for example that we have a news app with 3 tabs and we set cacheExtent = 1. As soon as we start swiping(sliding) from first to second tab, third tab is (pre)loading and thats causing the lag. Transition between second and third tab is going to be smooth(also from second to first), because it has nothing in front to preload. If we set cacheExtent=3 everything will run smooth, because it has nothing to preload, but this is expensive when we have lot of tabs. Maybe if you can change the speed of transition between tabs on swiping or force TabBar to start preloading next Tab after the swiping animation has finished, thats my ideas on this. Here is the small demo that will demonstrate the problem. |
Thank you for your further investigation. |
Thank you very much Alex, I'm aware of my code structure and will fix that and come back with results. Just one more question, is there a way to increase speed of swiping through tabs? I think that that will solve the problem, because when I tap on Tab, animation is both fast and smooth, I am just wondering is there a way to make swiping speed equal like is on tapping? And to be always consistent, no matter how fast or slow user slides with finger. Have a great time on festival. |
@aleksandar-radivojevic That's kinda easy XD, with the constant value |
Tried like this, but no success..
|
Can we use this plugin with PageView? |
@aleksandar-radivojevic Sorry about our busy in our work. PageView is the default implement. |
@aleksandar-radivojevic I thought that maybe you'll get better performance if you using a |
I've tried it but no success. Its the same. One thing that gain some kind of success is using Future.delayed() with duration of 300ms(which is duration of switching between tabs when swiping/sliding) for my network call inside Tab. But I use same call for fetching more posts bottom(Pagewise ListView package), so thats the problem.. |
@aleksandar-radivojevic And that's definitely what I was told you before, the request stuck UI thread. So I think this issue can be closed, and you can investigate about how to avoid this situation. |
Main Reason for this lag is highly discussed here, if you want to know more then visit here .... |
Reasonable alternative can be their ... [https://medium.com/fluttervn/making-bottom-tabbar-with-flutter-5ff82e8defe0](visit here) |
I'm building a news app(wordpress as a backend) that has 15 tabs(categories) in ExtendedTabBarView and when I set cache_extent=15, swiping(sliding with finger) between tabs is very smooth but the scrolling is laggy(probably due to high memory usage because it has to preload and cache 15 tabs with 10 post per tab), BUT when I set cache_extent=2, app works fine but swiping between tabs is laggy at the end of animation(transition), while when I TAP on single tab transition between tabs is always smooth, both on cache_extent 2 and 15. What can be the issue with this, I'm not saying thats your plugin a problem, but I need help, I'm struggling with this whole week. :D :D
If you need code sample or anything, just ask I will respond immediately. Keep up the good work. (:
The text was updated successfully, but these errors were encountered: