I have listview.builder widget which have several ListView.builder and GridView.count with scrollDirection:Axis.horizontal inside of it. All the data comes from the services and I am using FutureBuilder to fetch them. My problem is whenever I scroll the main ListView.builder,other listview items comes with animation(items comes from left, from right). Specially if I scroll fast. I didn't use any animation, and I don't have any idea about the problem, maybe its rebuilding everytime I scroll the lisview, but I am using AutomaticKeepAliveClientMixin for main ListView. Do you have any idea? Thanks for reading.
This question might be duplicate, I solved my problem using this answer: https://stackoverflow.com/a/57984979/10025471
The problem is everytime I scroll the listview, it's children rebuilding again and again. So I convert to stateful widget all of the children and I added AutomaticKeepAliveClientMixin to all of them. Now, there is no unwanted animation, and redundant rebuild
Related
I have a customscrollview which has some slivers inside it and it contains a sliverlist, the issue I'm facing is that when i scroll down or top the list's children get rebuilt, and that what i need to avoid, thanks in advance
I need a solution without relying on keep alive mixin
I'm not even sure if this is possible, but I want to change the physics from PageScrollPhysics to NeverScrollableScrollPhysics and back again without having to rebuild the PageView.
This is because I'm using it to render images that can be zoomed and the rebuild causes a blank image to appear before it loads again.
ValueNotifier Listener Builder can solve your problem, it will rebuild only child widget if value change.
For more details - ValueNotifierListenerBuilder
If I can't use a FutureBuilder inside a CustomScrollView how I can rebuild only the SliverList without also rebuilding the SliverAppBar?
I'm doing an app similar to Youtube, so like Youtube I have several buttons with the categories inside a ListView in the SliverAppBar area (Example in the image below) and a SliverList with the videos, but currently everything inside the CustomScrollView is rebuilt when I click on a category button. And the ListView inside the SliverAppBar always goes back to position 0 after rebuilding it instead of staying in the same position like Youtube.
The ideal result would be just rebuilding the SliverList. Or at least keep the ListView position (on the SliverAppBar) in the same position that was before rebuilding. How that can be done?
Consider the case that I have 3 adjacent list view with each list view having a sized widget of some height. Each list view has around 24 child items. I'm trying to scale the widget using onScaleUpdate in GestureDetector.
onScaleUpdate I want to change the height of each child item of all the 3 listviews.
Is rebuilding all child better or should I rebuild the whole widget?
As #Yeasin Sheikh pointed out, using ListView.builder is good because it builds only the needed children (the ones inside the screen and just a few ones outside as precaution). And as to actually answering your question, I'm no Flutter expert, but using ListView.builder I don't think it makes that much difference, Flutter is intelligent enough to solve this by itself.
I am making an app whose structure is very simple.
A ListView with Listtiles in it.
I want to add animation such that when the screen is opened the listtiles slide in.
Flutter provides a AnimatedList Widget.
Perhaps this native widget will give you the desired output