1

I have a ListView.builder() that I don't want its items to re-render, I tried this solution Solution but nothing happened, It kept re-rendering so, I don't know what is the problem.

Code

StreamBuilder<Object>(
        stream: Firestore.instance
            .collection('Khatma Collection')
            .document('Khatma 1')
            .collection('Videos')
            .snapshots(),
        builder: (context, AsyncSnapshot snapshot) {
          if (snapshot.hasData) {
            return ListView.builder(
          shrinkWrap: true,
          itemCount: snapshot.data.documents.length,
          itemBuilder: (context, i) {
            var rng = new Random();
            int ii = rng.nextInt(4);
            if (ii == iii) {
            } else {
              iii = ii;
              var link = snapshot.data.documents[ii].data['Link'];
              var uploader = snapshot.data.documents[ii].data['Uploader'];
              final videoPlayerController =
                  VideoPlayerController.network(link);
              chewieController = ChewieController(
                allowMuting: true,
                autoInitialize: true,
                deviceOrientationsAfterFullScreen: orientation,
                allowFullScreen: true,
                aspectRatio: 16 / 9,
                videoPlayerController: videoPlayerController,
              );
              return SingleChildScrollView(
                child: Column(
                  children: [
                    Chewie(
                      controller: chewieController,
                    ),
                    ),
                  ],
                ),
              );
            }
          },
        );
DeveloperOmar100
  • 463
  • 1
  • 4
  • 10
  • Comments are not for extended discussion; this conversation has been [moved to chat](https://chat.stackoverflow.com/rooms/221012/discussion-on-question-by-developeromar100-how-to-keep-the-items-in-listview-bui). – Samuel Liew Sep 05 '20 at 13:14

3 Answers3

0

You could try this...

addRepaintBoundaries: false,
0

use ListView() or Column widget instead

DNS
  • 851
  • 11
  • 19
0

Use this property in Listview.builder : addAutomaticKeepAlives: true