Home > Blockchain >  Flutter- How to render all items in the listview.builder at once and only once
Flutter- How to render all items in the listview.builder at once and only once

Time:11-24



I have a problem in flutter in listview.builder where it only renders the shown items, not all of them (even if they were not shown), and when I scroll down or up it renders the not shown items and re-renders the already rendered items.

It's not actually a problem, It's good for the phone memory to only render the shown items, but for me, it's a problem, because it's difficult for me to do some manipulations on the items.

the manipulations are like getting data from every item like the price of the item if it was higher than $100 and then printing the total amount of them on the bottom of the screen.
I can't do this one, because it doesn't show all of the items to get the data from them, and when I scroll down, it gets the data from the not shown items, but when I scroll back up, it gets the data from the already shown items again !

  • for Example, if the shown items have this data = 300, and the not shown items have this data = 800, at first it will get 300, and when I scroll down, it will get 1100, but when I get back up, it will get 1400



    I really want to fix this problem, it's holding me back from finishing my project.

    Thank you so much for your time.

  • CodePudding user response:



    So I solved the problem by only putting Listview.builder in SingleChildScrollView, and that solved all the problems.

    Thanks for all your help.

    • Related