I am new to flutter, I want to build a list of videos with flutter and firebase so, I built it with ListView.builder()
it worked but as you know ListView.builder()
only builds what is on the screen so, If I scrolled down and want to see something up, It will rebuild, I don't want it to rebuild.
Code
return 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'];
var likes = snapshot.data.documents[ii].data['Likes'];
var like = likes.toString();
bool liked;
if (int.parse(like) > 0) {
liked = true;
} else if (int.parse(like) == 0) {
liked = false;
}
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,
),
),
],
),
);
}
},
);
}
},
),