我想要keepAlive我已经呈现的小部件ListView.我尝试了addAutomaticKeepAlives:true按ListView类提供的属性.
这是我使用的示例代码.SliverChildBuilderDelegate委托中提供的相同问题SliverList.
ListView.builder(
itemBuilder: (context,index){
return Card(
child: Container(
child: Image.asset("images/${index+1}.jpg",fit: BoxFit.cover,),
height: 250.0,
),
);
},
addAutomaticKeepAlives: true,
itemCount:40 ,
);
Run Code Online (Sandbox Code Playgroud)