I have a list view where the image from api is loaded, I noticed that the image keeps disappearing for few seconds when scrolling once in a while. Here is the code on the image part only:
Container(
padding: EdgeInsets.only(top:5.0,left:15.0,right:1.0,bottom:0.0),
constraints: new BoxConstraints.expand(
height: 130.0,
width: 150.0,
),
decoration: new BoxDecoration(
image: new DecorationImage(
image: NetworkImage(artworksAndEventsFinal[index]['thumbnail']),fit: BoxFit.cover,),
),
child: new Stack(
children: <Widget>[
new Positioned(
right: 0.0,
bottom: 0.0,
child: Container(
height: 24.0,
padding: EdgeInsets.only(top:5.0,left:10.0,right:5.0,bottom:5.0),
decoration: new BoxDecoration(
color: Theme.of(context).primaryColor,
),
child: new Text(artworksAndEventsFinal[index]['year'],
style: new TextStyle(
fontWeight: FontWeight.bold,
fontSize: 11.0,
color: Colors.white
)
),
)
),
new Positioned(
right: 3.0,
top: 0.0,
child: new Icon(Icons.favorite_border,color:
Colors.white,),
),
],
)
),
Change the cacheExtent value to 9999 and it works for me
ListView.builder(
cacheExtent: 9999,
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With