Render an image only when it'll visible

188

You'll need to use Listview.builder with itemBuilder instead of a child

It will allow you to only render what is on the screen or what is likely to be on scrolled in the very near future - your performance will be considerably improved

  • I recommend watching this video from the Flutter Team on this topic (lazy load a big list view) at flutter.io - if you'd like to go deeper into the topic

Illustration of Listview.builder

Share:
188
Marcos Gianetti
Author by

Marcos Gianetti

Updated on December 31, 2022

Comments

  • Marcos Gianetti
    Marcos Gianetti over 1 year

    Can i render an imagens only it'll visuble in scrollview?

    My app has an list view with many products, when I scrolling down many times the performance of my app is down (i'm using a lazy list), i guess it's becase there many imagens (from web) render up my screen.

    I'm thinking to do something like it:

    enter image description here

    • Yeasin Sheikh
      Yeasin Sheikh almost 3 years
      i think builder already does that for us. like Listview.builder
    • Marcos Gianetti
      Marcos Gianetti almost 3 years
      @YeasinSheikh I already think it, but i'm not understanding why the performance down when I scroll for many time.
    • Aristidios
      Aristidios almost 3 years
      Are you using itemBuilder with it instead of a child ? Let us know if your still having issues - I up voted your question
  • Top-Master
    Top-Master almost 3 years
    You could edit your other answer! If this is a suggestion, a comment is more than enough.
  • Aristidios
    Aristidios almost 3 years
    You can see my deleted answer ?
  • Aristidios
    Aristidios almost 3 years
    This is my new answer it's better
  • Aristidios
    Aristidios almost 3 years
    should I include the YouTube link to the video? I didn't now if I could ?
  • Marcos Gianetti
    Marcos Gianetti almost 3 years
    I saw the video you was posted, it really will help me! @Aristidios
  • Top-Master
    Top-Master almost 3 years
    No, now it's gone; Could you edit and bring down image size? or just delete image, it would be no problem, because the OP has already image showing the same.
  • Aristidios
    Aristidios almost 3 years
    @MarcosGianetti Your welcome amigo ; ) I'll put the link back - I didn't know if I could ^^ - you should Up Vote - Yeasin Sheikh - too his answer was right : )
  • Marcos Gianetti
    Marcos Gianetti almost 3 years
    I'll publish here and close the thread, now I know what I'll need do at my code, thanks youtube.com/watch?v=qax_nOpgz7E&t=782s
  • Aristidios
    Aristidios almost 3 years
    I added it back : ) your welcome ! See you !